SOLUTIONS
LEETCODE.
Hard difficulty analysis and solutions.
| Problem | Difficulty | Complexity | Date |
|---|---|---|---|
| 0132 Palindrome Partitioning II | Hard | T: O(N^2) / S: O(N) | Mar 2026 |
| 0135 Candy | Hard | T: O(N) / S: O(N) | Mar 2026 |
| 0140 Word Break II | Hard | T: O(N * 2^N) / S: O(N * 2^N) | Mar 2026 |
| 0149 Max Points on a Line | Hard | T: O(N^2) / S: O(N) | Mar 2026 |
| 0154 Find Minimum in Rotated Sorted Array II | Hard | T: O(N) worst case, O(log N) average / S: O(1) | Mar 2026 |
| 0174 Dungeon Game | Hard | T: O(M * N) / S: O(N) | Mar 2026 |
| 0188 Best Time to Buy and Sell Stock IV | Hard | T: O(N * K) / S: O(K) | Mar 2026 |
| 0212 Word Search II | Hard | T: O(M * N * 4 * 3^(L-1)) where L is the maximum word length / S: O(W * L) where W is the number of words | Mar 2026 |
| 0214 Shortest Palindrome | Hard | T: O(N) where N is the length of the string / S: O(N) for the combined string and the LPS array | Mar 2026 |
| 0218 The Skyline Problem | Hard | T: O(N log N) where N is the number of buildings / S: O(N) for the heap and the critical points | Mar 2026 |
| 0220 Contains Duplicate III | Hard | T: O(N) where N is the length of the array / S: O(min(N, indexDiff)) for the bucket map | Mar 2026 |
| 0224 Basic Calculator | Hard | T: O(N) where N is the length of the string / S: O(N) for the stack in the worst case of nested parentheses | Mar 2026 |
| 0233 Number of Digit One | Hard | T: O(log N) where N is the input number / S: O(1) constant extra space | Mar 2026 |
| 0239 Sliding Window Maximum | Hard | T: O(N) where N is the length of the array / S: O(K) where K is the window size | Mar 2026 |
| 0273 Integer to English Words | Hard | T: O(1) since the input is bounded by 2^31 - 1 (at most 10 digits) / S: O(1) for the same reason | Mar 2026 |
| 0282 Expression Add Operators | Hard | T: O(N * 4^N) where N is the length of the string / S: O(N) for the recursion depth | Mar 2026 |
| 0295 Find Median from Data Stream | Hard | T: O(log N) per insertion, O(1) per median query / S: O(N) where N is the total number of inserted elements | Mar 2026 |
| 0297 Serialize and Deserialize Binary Tree | Hard | T: O(N) where N is the number of nodes in the tree / S: O(N) for storing the serialized string and the recursion stack | Mar 2026 |
| 0301 Remove Invalid Parentheses | Hard | T: O(2^N) where N is the length of the string / S: O(N) for the recursion depth and the expression being built | Mar 2026 |
| 0312 Burst Balloons | Hard | T: O(N^3) / S: O(N^2) | Mar 2026 |