~/lc-grind
#28 - Find the Index of the First Occurrence in a String
Sep 29, 2025Find the starting index of the first occurrence of a substring (`needle`) within another string (`haystack`), or return -1 if it's not found.
#6 - Zigzag Conversion
Sep 26, 2025Master the zigzag pattern by learning how to rearrange a string row by row, as seen in the classic "PAYPALISHIRING" example.
#151 - Reverse Words in a String
Sep 25, 2025Master the art of string manipulation by reversing the order of words while efficiently trimming all excess spaces using a two-pointer technique.
#14 - Longest Common Prefix
Sep 24, 2025Find the longest starting substring shared by all strings in an array, or return an empty string if none exists.
#58 - Length of Last Word
Sep 23, 2025Easily find the length of the final word in a string, even when trailing or multiple spaces are present.
#12 - Integer to Roman
Sep 22, 2025Convert any integer between 1 and 3999 into its corresponding Roman numeral by strategically applying standard symbols and subtractive combinations like IV, IX, XL, and CM.
#13 - Roman to Integer
Sep 22, 2025Efficiently convert a valid Roman numeral string to its integer equivalent by summing the values of its symbols while handling subtractive notation cases like "IV" for 4 or "XC" for 90.
#42 - Trapping Rain Water
Sep 19, 2025Master multiple techniques—from two pointers to dynamic programming—to efficiently calculate how much rainwater a topographic elevation map can trap.
#135 - Candy
Sep 18, 2025Minimize candy distribution while ensuring every child gets at least one and those with higher ratings than neighbors receive more, using a clever two-pass greedy approach.
#134 - Gas Station
Sep 17, 2025Find the unique starting gas station index where a circular journey is possible by ensuring the total gas never dips below the cost at any point.