2023 June

    LeetCode 30. Substring with Concatenation of All Words

    Because all the words are the same length, we can use hash map to check for substring from index i to index i +word length * words number.

    LeetCode 42. Trapping Rain Water

    We can calculate the water amount by columns. For position i, the water it can contains is based on the left max height column and the right max height columns.

    LeetCode 135. Candy

    This problem can be see as finding peak and valley. And we need to start checking the peak in order to remove the redundant count.


TOP
COMMENT
made with ❤️ by o_oyao
©o_oyao 2019-2024

|