LeetCode
September LeetCoding Challenge
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
August LeetCoding Challenge
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Detect Capital
- Design HashSet
- Valid Palindrome
- Power of Four
- Add and Search Word Data structure design
- Find All Duplicates in an Array
- Vertical Order Traversal of a Binary Tree
- Path Sum III
- Rotting Oranges
- Excel Sheet Column Number
- H-Index
- Pascal's Triangle II
- Iterator for Combination
- Longest Palindrome
- Non-overlapping Intervals
- Best Time to Buy and Sell Stock III
- Distribute Candies to People
- Numbers With Same Consecutive Differences
- Goat Latin
- Reorder List
- Sort Array By Parity
- Random Point in Non-overlapping Rectangles
- Stream of Characters
- Sum of Left Leaves
- Minimum Cost For Tickets
- Fizz Buzz
- Find Right Interval
- Implement Rand10() Using Rand7()
- Pancake Sorting
- Largest Component Size by Common Factor
- Delete Node in a BST
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
- Reverse Words in a String: Pointer
- Pow(x,n): Recursion
- Top K Frequent Elements: Bucket
- Course Schedule II: BFS
- Add Binary
- Remove Linked List Elements
- Word Search
- Binary Tree Zigzag Level Order Traversal
- Single Number III
- All Paths From Source to Target
- Find Minimum in Rotated Sorted Array II
- Add Digits
- Construct Binary Tree from Inorder and Postorder Traversal
- Task Scheduler
- Best Time to Buy and Sell Stock with Cooldown: State machine
- Word Break II
- Climbing Stairs: DP
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