Skip to content

TASHMITVERMA/leetcode_top150

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Top 150

Problem Algorithms Time Complexity Space Complexity
49.Group Anagrams Miscellaneous O(N) O(N)
121. Best Time to Buy and Sell Stock Sliding window O(N) O(N)
191. Number of 1 Bits Miscellaneous O(N) O(logN)
104. Maximum Depth of Binary Tree DFS O(N) O(1)
502. IPO Priority Queue Greedy O(nlogn + klogn) O(N)
15. 3Sum 2 pointer O(nlog n) O(1)
13. Roman to Integer Misc O(N) O(1)
19. Remove Nth Node From End of List slow fast O(N) O(1)
380. Insert Delete GetRandom O(1) Misc O(1) O(1)
130. Surrounded Regions DFS O(V*E) O(N)
201. Bitwise AND of Numbers Range Bit manipulation O(log n) O(1)
141. Linked List Cycle turtle hare O(N) O(1)
322. Coin Change DP O(m*n) O(N)
173. Binary Search Tree Iterator DFS O(N) O(N)
290. Word Pattern 2 way mapping O(N) O(N)
392. Is Subsequence pointer O(N) O(1)
14. Longest Common Prefix Misc O(Nlog N)+N) O(1)
134. Gas Station misc O(N) O(1)
64. Minimum Path Sum Misc O(N*M) O(N*M)
128. Longest Consecutive Sequence Hash set O(N) O(N)
45. Jump Game II Misc O(N) O(1)
39. Combination Sum Backtrack O(2^(n)) O(N)
162. Find Peak Element Binary Search O(log N) O(1)
238. Product of Array Except Self Left-Right prod O(N) O(N)
27. Remove Element Misc O(N) O(1)
198. House Robber DP O(N) O(N
219. Contains Duplicate II algo-hash O(N) O(N)
222. Count Complete Tree Nodes dfs O(N) O(N)
242. Valid Anagram Array O(N) O(1)
530. Minimum Absolute Difference in BST inorder O(nlog(n)+n) O(N)
17. Letter Combinations of a Phone Number rec O(4^digit length*n) O(1)
5. Longest Palindromic Substring DP O(N^2) O(N)
101. Symmetric Tree DFS O(N) O(1)
226. Invert Binary Tree Post order O(N) O(1)
36. Valid Sudoku 2D-DP O(N^2) O(N^2)
274. H-Index Greedy O(NlogN) O(1)
151. Reverse Words in a String 2 POINTER O(N) O(N)
135. Candy Greedy O(N) O(N)
209. Minimum Size Subarray Sum 2 POINTER O(N) O(1)
200. Number of Islands DP O(N2) O(N2
11. Container With Most Water sliding window O(N) O(1)
100. Same Tree DFS O(N) O(1)
67. Add Binary Misc O(N) O(1)
22. Generate Parentheses Recursion O(2^N) O(1)
212. Word Search II DFS O(TLE)
74. Search a 2D Matrix binary search O(NlogN) O(N2)
25. Reverse Nodes in k-Group LL O(N) O(1)
63. Unique Paths II Dp O(N2) O(N2)
295. Find Median from Data Stream HEAP O(N) O(N)
30. Substring with Concatenation of All Words Sliding window O(N2) O(1)
205. Isomorphic Strings Map O(N) O(N)
21. Merge Two Sorted Lists LL O(N) O(N)
73. Set Matrix Zeroes Misc O(N2) O(N)
133. Clone Graph DFS O(V+E) O(V)
106. Construct Binary Tree from Inorder and Postorder Traversal Recur O(N) O(1)
70. Climbing Stairs DP O(N) O(N)
33. Search in Rotated Sorted Array Binary search log(N) O(1)
300. Longest Increasing Subsequence Binary Search O(nlogn) O(1)
12. Integer to Roman Misc O(1) O(1)
105. Construct Binary Tree from Preorder and Inorder Traversal DFS O(N) O(N)
228. Summary Ranges Misc O(N) O(N)
46. Permutations Recur O(N*N!) O(N)
122. Best Time to Buy and Sell Stock II DP O(N) O(N)
117. Populating Next Right Pointers in Each Node II Tree O(N) O(N)
76. Minimum Window Substring Sliding window with Hash O(N) O(1)
190. Reverse Bits Bit Manipulation O(n) O(1)
50. Pow(x, n Recur O(logN) O(logN)
53. Maximum Subarray Greedy O(N) O(1)
34. Find First and Last Position of Element in Sorted Array BInary search log(N) O(1)
120. Triangle DP O(N2) O(N)
50. Evaluate Reverse Polish Notation Misc O(N) O(N)
4. Median of Two Sorted Arrays Binary search O(log (m+n)) O(1)
215. Kth Largest Element in an Array Misc O(nlogn) O(n)
189. Rotate Array Misc O(N) O(1)
129. Sum Root to Leaf Numbers BFS O(N) O(1)
82. Remove Duplicates from Sorted List II LL O(N) O(1)
56. Merge Intervals Misc O(nlogn) O(1)
124. Binary Tree Maximum Path Sum BFS O(N) O(1)
25. Valid Palindrome Misc O(n) O(1)
48. Rotate Image Misc O(n2) O(1)
289. Game of Life Misc O(mn) O(1)
79. Word Search Recur O(M * N * 4^L) O(L)
3. Longest Substring Without Repeating Characters sliding window O(n) O(1)
236. Lowest Common Ancestor of a Binary Tree DFS O(n) O(1)
42. Trapping Rain Water sliding window O(N) O(1)
28. Find the Index of the First Occurrence in a String Misc O(MN) O(1)
167. Two Sum II - Input Array Is Sorted sliding O(n) O(1)
383. Ransom Note Hashing O(n) O(n)
68. Text Justification Misc O(n) O(n)
72. Edit Distance DP O(N2) O(N2)
-- -- -- --
-- -- -- --
-- -- -- --
-- -- -- --
-- -- -- --
-- -- -- --

Releases

No releases published

Packages

No packages published

Languages