Skip to content

ozdemir08/LeetCode

Repository files navigation

LeetCode

My codes for some problems in Leet Code

Solved problems

Title Solutions Time Space Difficulty
1. Two sum up Code O(N) O(N) Easy
2. Add two numbers Code O(N+M) O(1) Medium
3. Longest Substring Without Repeating Characters Code O(N) O(1) Medium
4. Median of Two Sorted Arrays Code O(log(n+m)) O(log(n+m)) Hard
5. Longest Palindromic Substring Code O(N^2) O(1) Medium
7. Reverse Integer Code O(1) O(1) Easy
10. Regular Expression Matching Code O(NM) O(NM) Hard
11. Container With Most Water Code O(N) O(1) Medium
15. 3Sum Code O(N^2) O(N^2) Medium
17. Letter Combinations of a Phone Number Code O(N) O(N) Medium
19. Remove Nth Node From End of List Code O(N) O(1) Medium
20. Valid Parantheses Code O(N) O(1) Easy
21. Merge Two Sorted Lists Code O(N+M) O(N+M) Easy
22. Generate Parentheses Code O(2^N?) O(2^N?) Medium
23. Merge k Sorted Lists Code O(NlogK) O(NK) Hard
24. Swap Nodes in Pairs Code O(N) O(N) Medium
25. Reverse Nodes in k-Group Code O(N) O(N) Hard
26. Remove Duplicates from Sorted Array Code O(N) O(1) Easy
29. Divide Two Integers Code O() O() __
31. Next Permutation Code O(N) O(1) Medium
32. Longest Valid Parantheses Code O() O() __
33. Search in Rotated Sorted Array Code O() O() __
34. Search for a Range Code O() O() __
36. Valid Sudoku Code O() O() __
37. Sudoku Solver Code O(?) O(?) Hard
41. First Missing Positive Code O() O() __
42. Trapping Rain Water Code O(N) O(N) Hard
44. Wildcard Matching Code O(NM) O(NM) Hard
45. Jump Game II Code O(N) O(1) Hard
49. Group Anagrams Code O(NMlogM) O(NM) Medium
50. Pow(x,n) Code O() O() __
51. N-Queens Code O(N!) O(N!) Hard
52. N-Queens II Code O(N^N) O(N) Hard
55. Jump Game Code O(N) O(1) Medium
56. Merge Intervals Code O(Nlog(N)) O(N) Medium
66. Unique Paths Code O(MN) O(MN) Medium
72. Edit Distance Code O(MN) O(MN) Hard
75. Sort Colors Code O(N) O(1) Medium
76. Minimum Window Substring Code O(N) O(1) Hard
79. Word Search Code O(NMK) O(N^2) Medium
84. Largest Rectangle in Histogram Code O(N), O(Nlog(N)) O(N) Hard
88. Merge Sorted Array Code O(N+M) O(1) Easy
91. Decode Ways Code O(N) O(N) Medium
94. Binary Tree Inorder Traversal Code O(N) O(N) Medium
98. Validate Binary Search Tree Code O(N) O(1) Medium
102. Binary Tree Level Order Traversal Code O(N) O(N) Medium
103. Binary Tree Zigzag Level Order Traversal Code O(N) O(N) Medium
116. Populating Next Right Pointers in Each Node Code O(N) O(1) Medium
124. Binary Tree Maximum Path Sum Code O(N) O(N) Hard
127. Word Ladder Code O(M) O(M) Medium
128. Longest Consecutive Sequence Code O(N) O(N) Hard
132. Palindrome Partitioning II Code O(N^2) O(N^2) Hard
139. Word Break Code O(N^2+M) O(N+M) Medium
140. Word Break II Code O(N^2*log(M)) O(N^2+M) Hard
145. Binary Tree Postorder Traversal Code O(N) O(N) Hard
146. LRU Cache Code O(1), O(1) O(1), O(1) Hard
149. Max Points on a Line Code O(N^2log(N)) O(N) Hard
153. Find Minimum in Rotated Sorted Array Code O(log(N)) O(1) Medium
154. Find Minimum in Rotated Sorted Array II Code O(N) O(1) Hard
162. Find Peak Element Code O(log N) O(log N) Medium
174. Dungeon Game Code O(NM) O(M) Hard
179. Largest Number Code O(NlogN) O(1) Medium
200. Number of Islands Code O(NM) O(NM) Medium
207. Course Schedule Code O(N+M) O(N+M) Medium
208. Implement Trie (Prefix Tree) Code O() O() Medium
210. Course Schedule II Code O(N+M) O(N+M) Medium
212. Word Search II Code O(NM+K) O(NM+K) Hard
236. Lowest Common Ancestor of a Binary Tree Code O(N) O(N) Medium
239. Sliding Window Maximum Code O(N) O(K) Hard
295. Find Median from Data Stream Code O(logN), O(1) O(1), O(1) Hard
297. Serialize and Deserialize Binary Tree Code O(N), O(N^2) O(N), O(N) Hard
301. Remove Invalid Parentheses Code O(?) O(?) Hard
310. Minimum Height Trees Code O(N) O(N) Medium
312. Burst Balloons Code O(N^3) O(N^2) Hard
315. Count of Smaller Numbers After Self Code O(Nlog(N)) O(Nlog(N)) Hard
322. Coin Change Code O(NM) O(M) Medium
329. Longest Increasing Path in a Matrix Code O(NM) O(NM) Hard
336. Palindrome Pairs Code O(NK^2) O(NK) Hard
347. Top K Frequent Elements Code O(Nlog(K)) O(N) Medium
352. Data Stream as Disjoint Intervals Code O(log(N)) O(N) Hard
354. Russian Doll Envelopes Code O(Nlog(N)) O(N) Hard
378. Kth Smallest Element in a Sorted Matrix Code O(N*(max-min)) O(1) Medium
395. Longest Substring with At Least K Repeating Characters Code O(N) O(1) Medium
403. Frog Jump Code O(N^2) O(N) Hard
407. Trapping Rain Water II Code O(N^2 M) O(NM) Hard
410. Split Array Largest Sum Code O(N^2M) O(NM) Hard
446. Arithmetic Slices II - Subsequence Code O(N^2) O(N^2) Hard
460. LFU Cache Code O(1), O(1) O(1), O(1) Hard
493. Reverse Pairs Code O(Nlog(N)) O(Nlog(N)) Hard
629. K Inverse Pairs Array Code O(NK) O(NK) Hard
630. Course Schedule III Code O(Nlog(N)) O(N) Hard
632. Smallest Range Code O(K*N) O(K) Hard
668. Kth Smallest Number in Multiplication Table Code O(Nlog(max-min)) O(1) Hard
689. Maximum Sum of 3 Non-Overlapping Subarrays Code O(N) O(N) Hard

About

My solutions for questions in the leetcode.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published