- Binary Tree
- Maximum Depth of Binary Tree
- Invert/Flip Binary Tree
- Binary Search Tree
- Lowest Common Ancestor of a Binary Search Tree
- Binary tree
- Same Tree
- Binary Tree Maximum Path Sum
- Binary Tree Level Order Traversal
- Lowest Common Ancestor of a Binary Tree
- Binary Tree Right Side View
- Subtree of Another Tree
- Construct Binary Tree from Preorder and Inorder Traversal
- Serialize and Deserialize Binary Tree
- Binary search tree
- Validate Binary Search Tree
- Kth Smallest Element in a BST
- Number of Islands (2)
- Flood Fill (2)
- 01 Matrix (2)
- Valid Sudoku
- Breath-first search
- Rotting Oranges
- As Far From Land As Possible
- Network Delay Time
- Either search
- Clone Graph
- Pacific Altantic Water Flow
- Topological sorting
- Course Schedule
Mention of k If you see a top or lowest k being mentioned in the question, it is usually a signal that a heap can be used to solve the problem, such as in Top K Frequent Elements.
If you require the top k elements use a Min Heap of size k. Iterate through each element, pushing it into the heap (for python heapq, invert the value before pushing to find the max). Whenever the heap size exceeds k, remove the minimum element, that will guarantee that you have the k largest elements.
- Merge K Sorted Lists
- K Closest Points to Origin
- Top K Frequent Elements
- Find Median from Data Stream
- Implement Trie (Prefix Tree)
- Add and Search Word
- Word Break
- Word Search II
- Two Sum (3)
- Ransom Note
- Group Anagrams
- Insert Delete GetRandom O(1)
- First Missing Positive
- LRU Cache
- All O one Data Structure