Solution to Excel Sheet Column Number by LeetCode

23 Apr

Question: https://leetcode.com/problems/excel-sheet-column-number/ Question Name: Excel Sheet Column Number This tiny website is hosted on a free provider. Therefore it is not as strong as the big guys. SORRY for any inconvenience recently.

Solution to Majority Element by LeetCode

9 Apr

Question: https://leetcode.com/problems/majority-element/ Question Name: Majority Element We can do it with a dictionary (O(N) time, O(N) space). For a better solution with O(N) time and O(1) space, we can remove pairs of different elements as many as possible, and the … Read More »

Solution to Excel Sheet Column Title by LeetCode

9 Apr

Question: https://leetcode.com/problems/excel-sheet-column-title/ Question Name: Excel Sheet Column

Solution to Fraction to Recurring Decimal by LeetCode

8 Apr

Question: https://leetcode.com/problems/fraction-to-recurring-decimal/ Question Name: Fraction to Recurring Decimal Again, a little mathematical puzzle. Pay attention to some corner cases.

Â

Solution to Compare Version Numbers by LeetCode

7 Apr

Question: https://leetcode.com/problems/compare-version-numbers/ Question Name: Compare Version Numbers Clean up the tailing 0(s), and the right answer is there.

Solution to Maximum Gap by LeetCode

6 Apr

Question: https://leetcode.com/problems/maximum-gap/ Question Name: Maximum Gap The solution uses the bucket sorting and Pigeonhole principle. We divide the input range into bucketCount ranges. Each sub-section has the same length, and the sum of all the sub-sections covers the whole input … Read More »

Solution to Combine Two Tables by LeetCode

28 Feb

Question: https://oj.leetcode.com/problems/combine-two-tables/ Question Name: Combine Two Tables This problem is used to check our knowledge in JOIN. LEFT JOIN is used here. But we should also know about the others like INNER JOIN, RIGHT JOIN and OUTER JOIN.

Solution to Find Peak Element by LeetCode

26 Dec

Question: https://oj.leetcode.com/problems/find-peak-element/ Question Name: Find Peak Element The key point is: return the index to ANY ONE of the peaks. So O(logN) is possible.

Solution to Intersection of Two Linked Lists by LeetCode

25 Dec

Question: https://oj.leetcode.com/problems/intersection-of-two-linked-lists/ Question Name: Intersection of Two Linked Lists

Solution to Min Stack by LeetCode

21 Dec

Question: https://oj.leetcode.com/problems/min-stack/ Question Name: Min Stack