Solution to Remove Duplicates from Sorted List II by LeetCode

23 Jun

Question: https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ Question Name: Remove Duplicates from Sorted List II

Solution to Remove Duplicates from Sorted List by LeetCode

23 Jun

Question: https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/ Question Name: Remove Duplicates from Sorted List

Solution to Largest Rectangle in Histogram by LeetCode

23 Jun

Question: https://oj.leetcode.com/problems/largest-rectangle-in-histogram/ Question name: Largest Rectangle in Histogram

Update on 2014-06-24: Thanks to optimization, the previous solution passed all the tests. But when I met with the question “Maximal Rectangle”, I realized the previous one is not the designed … Read More »

Solution to Remove Duplicates from Sorted Array II by LeetCode

20 Jun

Question: https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ Question Name: Remove Duplicates from Sorted Array II The second previous element might be overwritten in the last round.

Well, inspired by http://www.mitbbs.com/article_t/JobHunting/32770131.html, there is a better and more generic solution as:

With the parameter M … Read More »

Solution to Search in Rotated Sorted Array II by LeetCode

20 Jun

Question: https://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/ Question Name: Search in Rotated Sorted Array II I did not notice, there is no duplicate in Search in Rotated Sorted Array. SO I’ve done this in that question.

Solution to Combinations by LeetCode

20 Jun

Question: https://oj.leetcode.com/problems/combinations/ Question Name: Combinations

Solution to Subsets by LeetCode

20 Jun

Question: https://oj.leetcode.com/problems/subsets/ Question Name: Subsets

Solution to Word Search by LeetCode

19 Jun

Question: https://oj.leetcode.com/problems/word-search/ Question Name: Word Search The description and comments are misleading. Comments says “@param board, a list of lists of 1 length string”. And in the example, the input board is [[“ABCE”], [“SFCS”], [“ADEE”]]. But actually, in the tests, … Read More »

Solution to Minimum Window Substring by LeetCode

19 Jun

Question: https://oj.leetcode.com/problems/minimum-window-substring/ Question Name: Minimum Window Substring

Solution to Sort Colors by LeetCode

17 Jun

Question: https://oj.leetcode.com/problems/sort-colors/ Question Name: Sort Colors