Sunday, January 22, 2017

Code Review: Leetcode 56: Merge Intervals (II)

January 22, 2017

Introduction
Julia chose to study 13 questions posted by Gilad, reputation over 700. (the link is here), she came cross the code review: Finding overlapping time intervals. So, she likes to relate to her own practice. She did some work on Leetcode 56: Merge Interval, so she investigated how her practice was. One fact is that she had not made any submission through leetcode online judge on the algorithm. Her practice was too closed and had zero impact, and she decided to make changes this time.  

Workout

Julia's C# practice, code is  here.

Highlights of practice:

1. Julia studied the Java code, and then tried to figure out how to write a C# comparator. She figure out that it is better to use LINQ instead of comparator. She studies the post on stackoverflow.com.

2. Julia tried Leetcode online judge, first test case failed, when the intervals has only one interval. And then, Julia added edge case. line 92 - 93.

3. Julia submitted Leetcode online judge again, failed test case: two intervals, [1,4], [0,4], the merged interval should [0,4], not [1,4]. Forgot to use sortedIntervals, instead of using intervals. How to avoid this kind of writing issue.

Code review on stackexchange.com, link is here.

January 23, 2017

Code review is here; and C# code is here. She got 7 up-votes and 3 answers in less than 24 hours.

A new study

1. Study C# code review completed by Nick Udell, review link is here.

2. Study tag - inteval questions, review link is here.


No comments:

Post a Comment