This repository contains the NeetCode 75 problem list. Each problem includes its corresponding LeetCode link.
- 構造二叉樹(從前序遍歷、後序遍歷數組,構造出中序遍歷的二叉樹)
- KMP
- bucket sort
-
- Construct Binary Tree from Preorder and Inorder Traversal
- 217. Contains Duplicate
- 242. Valid Anagram
- 1. Two Sum
- 49. Group Anagrams
- 347. Top K Frequent Elements
- 238. Product of Array Except Self
- 36. Valid Sudoku
- 271. Encode and Decode Strings (Premium)
- 125. Valid Palindrome
- 167. Two Sum II - Input Array Is Sorted
- 15. 3Sum
- 11. Container With Most Water
- 42. Trapping Rain Water
- 121. Best Time to Buy and Sell Stock
- 3. Longest Substring Without Repeating Characters
- 424. Longest Repeating Character Replacement
- 567. Permutation in String
- 76. Minimum Window Substring
- 239. Sliding Window Maximum
- 20. Valid Parentheses
- 155. Min Stack
- 150. Evaluate Reverse Polish Notation
- 22. Generate Parentheses
- 739. Daily Temperatures
- 853. Car Fleet
- 84. Largest Rectangle in Histogram
- 206. Reverse Linked List
- 21. Merge Two Sorted Lists
- 143. Reorder List
- 19. Remove Nth Node From End of List
- 138. Copy List with Random Pointer
- 104. Maximum Depth of Binary Tree
- 100. Same Tree
- 226. Invert Binary Tree
- 124. Binary Tree Maximum Path Sum
- 102. Binary Tree Level Order Traversal
- 297. Serialize and Deserialize Binary Tree (Premium)
- 572. Subtree of Another Tree
- 105. Construct Binary Tree from Preorder and Inorder Traversal
- 98. Validate Binary Search Tree
- 230. Kth Smallest Element in a BST
- 236. Lowest Common Ancestor of a Binary Tree
- 208. Implement Trie (Prefix Tree)
- 211. Add and Search Word - Data structure design
- 703. Kth Largest Element in a Stream
- 1046. Last Stone Weight
- 973. K Closest Points to Origin
- 621. Task Scheduler
- 355. Design Twitter
- 452. Minimum Number of Arrows to Burst Balloons
- 435. Non-overlapping Intervals
- 322. Coin Change
- 763. Partition Labels
- 70. Climbing Stairs
- 322. Coin Change
- 300. Longest Increasing Subsequence
- 1143. Longest Common Subsequence
- 139. Word Break
- 377. Combination Sum IV
- 198. House Robber
- 213. House Robber II
- 91. Decode Ways
- 62. Unique Paths
- 55. Jump Game
- 221. Maximal Square
- 5. Longest Palindromic Substring
- 647. Palindromic Substrings
- 72. Edit Distance
- 312. Burst Balloons
Operation | Stack (LIFO) | Queue (FIFO) | Deque (Double-ended) |
---|---|---|---|
Insert | push() | enqueue() | addFirst()/addLast() |
Remove | pop() | dequeue() | removeFirst()/removeLast() |
Remove (No Exception) | - | poll() | pollFirst()/pollLast() |
Peek | peek() | peek() | getFirst()/getLast() |
Check Empty | isEmpty() | isEmpty() | isEmpty() |
Time Complexity | O(1) | O(1) | O(1) |
Space Complexity | O(n) | O(n) | O(n) |
- Like a stack of plates
- Only access from one end
- Common use: function call stack, undo operations
- Like a line of people
- Access from both ends but in specific order
- Common use: task scheduling, breadth-first search
- Like a deck of cards
- Access from both ends in any order
- Common use: sliding window, palindrome checking