LeetCode
July LeetCoding Challenge
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Arranging Coins: Maths
- Binary Tree Level Order Traversal II: DFS
- Prison Cells After N Days: Maths
- Ugly Number II: DP
- Hamming Distance: Bitwise Manipulation
- Plus One: Maths
- Island Perimeter: BFS
- 3Sum: Two pointers
- Maximum Width of Binary Tree: DFS
- Flatten a Multilevel Doubly Linked List: Queue
- Subsets: DP
- Reverse Bits: Bitwise
- Same Tree: DFS
- Angle Between Hands of a Clock: Math
June LeetCoding Challenge
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Invert Binary Tree: Tree Traversal
- Delete Node in a Linked List: Linked List
- Two City Scheduling: DP
- Reverse String: String
- Random Pick With Weight: Binary Search + Probability
- Queue Reconstruction by Height: Greedy
- Coin Change 2: DP
- Power of Two: Bitwise manipulation
- Is Subsequence: Two pointers / DP
- Search Insert Position: Binary Search
- Sort Colors: Two Pointers
- Insert Delete GetRandom: Hash Table
- Largest Divisible Subset: DP
- Cheapest Flights Within K Stops: DP
- Search in a Binary Search Tree: Recursive
- Validate IP Address: String
- Surrounded Regions: BFS
- H Index II: Binary Search
- Longest Duplicate Substring:
- Permutation Sequence: Maths
- Dungeon Game: DP
- Single Number II: Bitwise Manipulation
- Count Complete Tree Nodes: Tree Traversal
- Unique Binary Search Trees: DP
- Find the Duplicate Number: Cycle Detect
- Sum Root To Leaf Numbers: DFS
- Perfect Squares: DP
- Reconstruct Itinerary: DFS
- Unique Paths: DP
- Word Search: Trie + DFS
May LeetCoding Challenge
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- First Bad String: Binary search.
- Jewels and Stones: Hash Table
- Ransom Note: Hash Table
- Number Complement: Bitwise Manipulation
- First Unique Character In a String: Hash Table
- Majority Element: Ad hoc
- Cousins in Binary Tree: BFS / Recursion
- Check if it is straight line: Cross Product
- Valid Perfect Square: Math
- Find the Town Judge: Graph Theory
- Flood Fill: BFS
- Single Element In a Sorted Array: Binary Search
- Remove K Digits: Greedy
- Implement Trie: Trie
- Maximum Sum Circular Subarray: DP
- Odd Even Linked List: Linked List
- Find All Anagrams in a String: Sliding window + Hash Table
- Permutation In String: Sliding window + Hash Table
- Online Stock Span: DP
- Kth-Smallest-Element-In-A-BST: BST
- Count Square Submatrices with All Ones: DP
- Sort Characters By Frequency: Hash Table
- Interval List Intersections: Two Pointers
- Construct Binary Search Tree from Preorder Traversal: Binary Search Tree
- Uncrossed Lines: DP
- Contiguous Array: Hash Table
- Possible Bipartition: Bipartite Graph
- Counting Bits: Math
- Course Schedule: Topological Sort
- K Closest Points to Origin: Priority_queue, Sort
- Edit Distance: DP
30-Day (April) LeetCoding Challenge
Click here for problem descriptions.
- Single Number: Bitwise Manipulation
- Happy Number: Implementation
- Maximum Subarray: DP
- Move Zeros: Two pointers
- Best Time to Buy and Sell Stock II: Greedy
- Group Anagrams: Hash Table