Contains all my Leetcode solutions with Problem statement, their Solutions, Time and Space complexity analaysis.
# | Title | Difficulty | Remarks |
---|---|---|---|
200 | Number of Islands | Medium | Done |
79 | Word Search | Medium | Teaches how to move in all directions of an element in a matrix. |
329 | Longest Increasing Path in a Matrix | Hard | Done |
695 | Max Area of Island | Medium | None |
130 | Surrounded Regions | Medium | None |
743 | Network Delay Time | Medium | Done :: Dijkstra implementaion with min space utilisation |
787 | Cheapest Flights Within K Stops | Medium | Time Complexity left |
909 | Snakes and Ladders | Medium | Done :: Important |
785 | Is Graph Bipartite? | Medium | Time Complexity left |
886 | Possible Bipartition | Medium | Time Complexity left |
207 | Course Schedule | Medium | Done :: Reduced to cycle detection in graph |
210 | Course Schedule II | Medium | Done |
127 | Word Ladder | Medium | Revise at the time of interview. Complete BFS application |
547 | Friend Circles | Medium | DFS implemenation approach is good.Time Complexity left |
684 | Redundant Connection | Medium | Time Complexity left Kruskal Algorithm |
# | Title | Difficulty | Remarks |
---|---|---|---|
146 | LRU Cache | Medium | Important for interviews |
208 | Implement Trie (Prefix Tree) | Medium | Time complexity left |
211 | Add and Search Word | Medium | Time complexity left |
380 | Insert Delete GetRandom O(1) | Medium | Complexity left |
# | Title | Difficulty | Remarks |
---|---|---|---|
198 | House Robber | Easy | None |
746 | Min Cost Climbing Stairs | Easy | None |
120 | Triangle | Medium | None |
64 | Minimum Path Sum | Medium | None |
322 | Coin Change | Medium | None |
983 | Minimum Cost For Tickets | Medium | None |
279 | Perfect Squares | Medium | None |
300 | Longest Increasing Subsequence | Medium | None |
62 | Climbing Stairs | Easy | None |
70 | Unique Paths | Medium | None |
63 | Unique Paths II | Medium | None |
673 | Number of Longest Increasing Subsequence | Medium | None |
337 | House Robber III | Medium | Different type of DP(Recursion imp.) |
72 | Edit Distance | Hard | Done :: Classic |
368 | Largest Divisible Subset | Medium | Done |
# | Title | Difficulty | Remarks |
---|---|---|---|
78 | Subsets | Medium | Base Concept Problem |
90 | Subsets II | Medium | Base Concept Problem |
46 | Permutations | Medium | Base Concept Problem |
47 | Permutations II | Medium | Base Concept Problem |
77 | Combinations | Medium | Check if a better approach |
17 | Letter Combinations of a Phone Number | Medium | None |
39 | Combination Sum | Medium | None |
# | Title | Difficulty | Remarks |
---|---|---|---|
105 | Construct Binary Tree from Preorder and Inorder Traversal | Medium | Done :: How to find index quickly |
103 | Binary Tree Zigzag Level Order Traversal | Medium | None |
230 | Kth Smallest Element in a BST | Medium | None |
116 | Populating Next Right Pointers in Each Node | Medium | None |
111 | Minimum Depth of Binary Tree | Easy | None |
112 | Path Sum | Easy | BFS and DFS |
617 | Merge Two Binary Trees | Easy | Time Complexity left |
235 | LCA of a BST | Easy | Done |
236 | LCA of a BT | Medium | Done :: Imp |
101 | Symmetric Tree | Easy | Done :: Imp |
98 | Validate Binary Search Tree | Medium | Done |
104 | Maximum Depth of Binary Tree | Easy | Done |
108 | Convert Sorted Array to BST | Easy | Done :: Imp |
102 | Binary Tree Level Order Traversal | Medium | Done |
# | Title | Difficulty | Remarks |
---|---|---|---|
238 | Product of Array Except Self | Medium | None |
334 | Increasing Triplet Subsequence | Medium | None |
1305 | All Elements in Two Binary Search Trees | Medium | Merger Logic :: Left-Can return list/or not |
525 | Contiguous Array | Medium | Done |
560 | Subarray Sum Equals K | Medium | Application of logic same as 525 |
11 | Container With Most Water | Medium | Done |
88 | Merge Sorted Array | Easy | Done :: No Extra space, trick |
1365 | How Many Numbers Are Smaller Than the Current Number | Easy | Done :: Trick |
42 | Trapping Rain Water | Hard | Done :: Classic |
# | Title | Difficulty | Remarks |
---|---|---|---|
34 | Seach for a Range in an array | Medium | Done |
33 | Search in Rotated Sorted Array | Medium | Done |
162 | Find Peak Element | Medium | Done :: Left neighbour causes TLE Concept |
56 | Merge Intervals | Medium | None |
986 | Interval List Intersections | Medium | Code is Poetry |
74 | Search a 2D Matrix | Medium | Time Complexity left |
240 | Search a 2D Matrix II | Medium | Done :: Base concept problem |
35 | Search Insert Position | Easy | Done |
528 | Random Pick with Weight | Medium | Done :: IMP |
# | Title | Difficulty | Remarks |
---|---|---|---|
160 | Intersection of Two Linked Lists | Easy | None |
142 | Linked List Cycle II | Medium | Complexity Left |
287 | Find the Duplicate Number | Medium | None |
141 | Linked List Cycle | Easy | Done |
138 | Copy List with Random Pointer | Medium | Done :: Go through :: See O(1) space solution |
237 | Delete Node in a Linked List | Easy | Done :: Trick |
206 | Reverse Linked List | Easy | Done :: Dummy Node |
21 | Merge Two Sorted Lists | Easy | Done |
876 | Middle of the Linked List | Easy | Done |
2 | Add Two Numbers | Medium | Done |
# | Title | Difficulty | Remarks |
---|---|---|---|
215 | Kth Largest Element in an Array | Medium | Done :: TradeOff |
1046 | Last Stone Weight | Easy | None |
23 | Merge k Sorted Lists | Hard | None |
621 | Task Scheduler | Medium | Pre knowledge required for interviews. |
# | Title | Difficulty | Remarks |
---|---|---|---|
344 | Reverse String | Easy | Done |
387 | First Unique Character in a String | Easy | Done |
242 | Valid Anagram | Easy | Done |
125 | Valid Palindrome | Easy | Done :: Regex in java |
28 | Implement strStr() | Easy | Done :: Break into window size :: Complexity left |
38 | Count and Say | Easy | Done :: Complexity left |
14 | Longest Common Prefix | Easy | Done :: Complexity left |
443 | String Compression | Easy | How the Last index condition is included. |
415 | Add Strings | Easy | Better code writing. Use of ascii values |
1400 | Construct K Palindrome Strings | Medium | Good concept of Palindrome |
# | Title | Difficulty | Remarks |
---|---|---|---|
443 | Asteroid Collision | Medium | Break down the code in smaller cases |
496 | Next Greater Element I | Medium | Generic implementation of next greater element |
1019 | Next Greater Node In Linked List | Medium | Done |
503 | Next Greater Element II | Medium | Done |
789 | Daily Temperatures | Medium | Done |
150 | Evaluate Reverse Polish Notation | Medium | Done |
# | Title | Difficulty | Remarks |
---|---|---|---|
50 | Pow(x, n) | Medium | Done :: Logic |
172 | Factorial Trailing Zeroes | Easy | Done :: Logic |
171 | Excel Sheet Column Number | Easy | Done |
# | Title | Difficulty | Remarks |
---|---|---|---|
463 | Island Perimeter | Easy | None |
844 | Backspace String Compare | Easy | None |
7 | Reverse Integer | Easy | Done :: Overflow condition |
# | Title | Difficulty | Topic | Remarks |
---|---|---|---|---|
136 | Single Number | Easy | Math | Done |
202 | Happy Number | Easy | Math | Time Complexity left |
52 | Maximum Subarray | Easy | DP | Kadane's algorithm |
283 | Move Zeroes | Easy | Array | Done |
122 | Best Time to Buy and Sell Stock II | Easy | Array | Done |
49 | Group Anagrams | Medium | HashMap/String | Time Complexity left |
NA | Counting Elements | Easy | HashMap | Done |
844 | Backspace String Compare | Easy | 2 pointers | Done :: Glance |
155 | Min Stack | Easy | Design | Done |
543 | Diameter of Binary Tree | Easy | Done |