• LeetCode "57. Insert Interval"

    LeetCode link Intuition The input is already sorted, so what we do is to find the range of the insert. Iterate the input, if current.end < new.start, just...

    LeetCode "56. Merge Intervals"

    LeetCode link Intuition Sort the start in ascending order. If the next start is smaller than the current end, it can be merged in. Update the end. If the nex...

    LeetCode "296. Best Meeting Point"

    LeetCode link Intuition Actually there’s no relation with algorithm, it’s more like some common-sense.The best point is just the middle of the locations in h...

    LeetCode "179. Largest Number"

    LeetCode link Intuition Sort the numbers as strings in ascending order, the comparator is (s2 + s1).compareTo(s1 + s2) solution 1234567891011121314151617181...

    LeetCode "166. Fraction to Recurring Decimal"

    LeetCode link Intuition Use a map to save the fractional index of each meet numerator. When the map contains a numerator, so it’s a repeating fractional, the...

    LeetCode "36. Valid Sudoku"

    LeetCode link Intuition It’s simple, just build a map to record all the values for each row, col and block. solution 123456789101112131415161718192021222324...

    LeetCode "149. Max Points on a Line"

    LeetCode link Intuition Each two points can lie on one line, use a map to save all the lines, key is the line(no matter the form you save, here is using the ...

    LeetCode "3. Longest Substring Without Repeating Characters"

    LeetCode link Intuition Use two pointers begin and end to represent the range of the substring. Use a set to save the characters that has appeared. when the ...

    LeetCode "76. Minimum Window Substring"

    LeetCode link Intuition Using two pointer to border the sliding window. Using a map to save the count of each character appearance and a map to save the coun...

    LeetCode "30. Substring with Concatenation of All Words"

    LeetCode link Intuition Build a set to store all the words Iterate the slice index from 0 to end. If all the words in the substring are appear once in the wo...