Skip to content

letterbeezps/leetcode-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode

This repo is build to collect leetcode algorithms we write.

Completion Statistic:

  • Python: 383
  • JavaScript: 25
  • Java: 3
  • C(++): 42

Total completed: 395

Solutions

Title Solutions Difficulty
1. Two Sum Python, JavaScript, C(++) Easy
2. Add Two Numbers Python, JavaScript Medium
3. Longest Substring Without Repeating Characters Python, JavaScript, C(++) Medium
4. Median of Two Sorted Arrays JavaScript, C(++) Hard
5. Longest Palindromic Substring Python, JavaScript, C(++) Medium
6. ZigZag Conversion Python, C(++) Medium
7. Reverse Integer Python Easy
8. String to Integer (atoi) Python Medium
9. Palindrome Number Python Easy
10. Regular Expression Matching Python, JavaScript Hard
11. Container With Most Water Python Medium
12. Integer to Roman Python Medium
13. Roman to Integer Python, JavaScript Easy
14. Longest Common Prefix Python, C(++) Easy
15. 3Sum Python Medium
16. 3Sum Closest Python Medium
17. Letter Combinations of a Phone Number Python Medium
18. 4Sum Python Medium
19. Remove Nth Node From End of List Python Medium
20. Valid Parentheses Python, JavaScript Easy
21. Merge Two Sorted Lists Python Easy
22. Generate Parentheses Python Medium
23. Merge k Sorted Lists Python, JavaScript Hard
24. Swap Nodes in Pairs Python Medium
25. Reverse Nodes in k-Group Python, JavaScript Hard
26. Remove Duplicates from Sorted Array Python, JavaScript Easy
27. Remove Element Python Easy
28. Implement strStr() Python Easy
29. Divide Two Integers Python Medium
30. Substring with Concatenation of All Words Python Hard
31. Next Permutation Python Medium
32. Longest Valid Parentheses Python Hard
33. Search in Rotated Sorted Array Python, JavaScript, C(++) Medium
34. Find First and Last Position of Element in Sorted Array Python, JavaScript Medium
35. Search Insert Position Python Easy
36. Valid Sudoku Python Medium
37. Sudoku Solver Python, Java Hard
38. Count and Say Python Easy
39. Combination Sum Python, JavaScript Medium
40. Combination Sum II Python Medium
41. First Missing Positive Python Hard
42. Trapping Rain Water Python, JavaScript Hard
43. Multiply Strings Python, C(++) Medium
44. Wildcard Matching Python Hard
45. Jump Game II Python Hard
46. Permutations Python Medium
47. Permutations II Python Medium
48. Rotate Image Python Medium
49. Group Anagrams Python, Java Medium
50. Pow(x, n) Python Medium
51. N-Queens Python Hard
52. N-Queens II Python Hard
53. Maximum Subarray Python, C(++) Easy
54. Spiral Matrix Python Medium
55. Jump Game Python Medium
56. Merge Intervals Python, C(++) Medium
57. Insert Interval Python, C(++) Hard
58. Length of Last Word Python Easy
59. Spiral Matrix II Python Medium
60. Permutation Sequence Python Medium
61. Rotate List Python Medium
62. Unique Paths Python Medium
63. Unique Paths II Python Medium
64. Minimum Path Sum Python Medium
66. Plus One Python Easy
67. Add Binary Python Easy
68. Text Justification Python Hard
69. Sqrt(x) Python Easy
70. Climbing Stairs Python Easy
71. Simplify Path Python Medium
72. Edit Distance Python Hard
73. Set Matrix Zeroes Python Medium
74. Search a 2D Matrix Python, JavaScript Medium
75. Sort Colors Python Medium
76. Minimum Window Substring Python, C(++) Hard
77. Combinations Python Medium
78. Subsets Python Medium
79. Word Search Python Medium
80. Remove Duplicates from Sorted Array II Python Medium
81. Search in Rotated Sorted Array II Python Medium
82. Remove Duplicates from Sorted List II Python Medium
83. Remove Duplicates from Sorted List Python Easy
84. Largest Rectangle in Histogram Python Hard
86. Partition List Python Medium
88. Merge Sorted Array Python, C(++) Easy
89. Gray Code Python Medium
90. Subsets II Python Medium
91. Decode Ways Python Medium
92. Reverse Linked List II Python Medium
93. Restore IP Addresses Python Medium
94. Binary Tree Inorder Traversal Python Medium
95. Unique Binary Search Trees II Python Medium
96. Unique Binary Search Trees Python Medium
98. Validate Binary Search Tree Python Medium
100. Same Tree Python Easy
101. Symmetric Tree Python Easy
102. Binary Tree Level Order Traversal Python, C(++) Medium
103. Binary Tree Zigzag Level Order Traversal Python Medium
104. Maximum Depth of Binary Tree Python Easy
105. Construct Binary Tree from Preorder and Inorder Traversal Python Medium
106. Construct Binary Tree from Inorder and Postorder Traversal Python Medium
107. Binary Tree Level Order Traversal II Python Easy
108. Convert Sorted Array to Binary Search Tree Python Easy
109. Convert Sorted List to Binary Search Tree Python Medium
110. Balanced Binary Tree Python Easy
111. Minimum Depth of Binary Tree Python Easy
112. Path Sum Python Easy
113. Path Sum II Python Medium
114. Flatten Binary Tree to Linked List Python Medium
115. Distinct Subsequences Python Hard
116. Populating Next Right Pointers in Each Node Python Medium
120. Triangle Python Medium
121. Best Time to Buy and Sell Stock Python Easy
122. Best Time to Buy and Sell Stock II Python Easy
123. Best Time to Buy and Sell Stock III Python Hard
124. Binary Tree Maximum Path Sum Python Hard
125. Valid Palindrome Python Easy
128. Longest Consecutive Sequence Python Hard
129. Sum Root to Leaf Numbers Python Medium
130. Surrounded Regions Python Medium
131. Palindrome Partitioning Python Medium
132. Palindrome Partitioning II Python Hard
133. Clone Graph Python Medium
134. Gas Station Python Medium
136. Single Number Python Easy
137. Single Number II Python Medium
139. Word Break Python, C(++) Medium
140. Word Break II Python Hard
141. Linked List Cycle Python Easy
142. Linked List Cycle II Python Medium
145. Binary Tree Postorder Traversal Python Hard
146. LRU Cache Python Medium
147. Insertion Sort List Python Medium
148. Sort List Python Medium
149. Max Points on a Line Python Hard
150. Evaluate Reverse Polish Notation Python Medium
151. Reverse Words in a String C(++) Medium
153. Find Minimum in Rotated Sorted Array Python Medium
154. Find Minimum in Rotated Sorted Array II Python Hard
155. Min Stack Python Easy
162. Find Peak Element Python Medium
165. Compare Version Numbers Python Medium
166. Fraction to Recurring Decimal Python Medium
167. Two Sum II - Input array is sorted Python Easy
169. Majority Element Python, JavaScript Easy
173. Binary Search Tree Iterator Python, C(++) Medium
174. Dungeon Game Python Hard
179. Largest Number Python Medium
187. Repeated DNA Sequences Python Medium
189. Rotate Array Python Easy
190. Reverse Bits C(++) Easy
191. Number of 1 Bits Python Easy
198. House Robber Python Easy
200. Number of Islands Python Medium
201. Bitwise AND of Numbers Range Python Medium
202. Happy Number Python Easy
204. Count Primes Python Easy
205. Isomorphic Strings Python, JavaScript Easy
206. Reverse Linked List Python Easy
207. Course Schedule Python Medium
208. Implement Trie (Prefix Tree) Python Medium
209. Minimum Size Subarray Sum Python Medium
210. Course Schedule II Python Medium
211. Add and Search Word - Data structure design Python Medium
212. Word Search II Python Hard
213. House Robber II Python Medium
214. Shortest Palindrome Python Hard
215. Kth Largest Element in an Array Python, JavaScript Medium
217. Contains Duplicate Python Easy
219. Contains Duplicate II Python Easy
220. Contains Duplicate III Python Medium
221. Maximal Square Python Medium
223. Rectangle Area Python Medium
224. Basic Calculator C(++) Hard
225. Implement Stack using Queues Python Easy
226. Invert Binary Tree Python Easy
227. Basic Calculator II Python Medium
228. Summary Ranges Python Medium
230. Kth Smallest Element in a BST Python Medium
231. Power of Two Python Easy
232. Implement Queue using Stacks Python, Java Easy
235. Lowest Common Ancestor of a Binary Search Tree Python Easy
236. Lowest Common Ancestor of a Binary Tree Python Medium
237. Delete Node in a Linked List Python Easy
238. Product of Array Except Self Python Medium
239. Sliding Window Maximum Python Hard
240. Search a 2D Matrix II Python Medium
241. Different Ways to Add Parentheses Python Medium
257. Binary Tree Paths Python Easy
260. Single Number III Python Medium
263. Ugly Number Python Easy
264. Ugly Number II Python Medium
268. Missing Number Python Easy
273. Integer to English Words Python Hard
274. H-Index Python Medium
275. H-Index II Python Medium
278. First Bad Version Python, C(++) Easy
279. Perfect Squares Python Medium
283. Move Zeroes Python Easy
287. Find the Duplicate Number Python Medium
289. Game of Life Python Medium
290. Word Pattern Python Easy
299. Bulls and Cows Python, JavaScript Easy
300. Longest Increasing Subsequence Python Medium
303. Range Sum Query - Immutable Python Easy
304. Range Sum Query 2D - Immutable Python Medium
305. Number of Islands II Python Hard
307. Range Sum Query - Mutable Python Medium
312. Burst Balloons C(++) Hard
316. Remove Duplicate Letters C(++) Hard
319. Bulb Switcher Python Medium
322. Coin Change Python Medium
326. Power of Three C(++) Easy
329. Longest Increasing Path in a Matrix Python Hard
331. Verify Preorder Serialization of a Binary Tree Python Medium
332. Reconstruct Itinerary Python Medium
337. House Robber III Python Medium
338. Counting Bits Python Medium
341. Flatten Nested List Iterator Python Medium
343. Integer Break Python Medium
347. Top K Frequent Elements Python Medium
349. Intersection of Two Arrays Python Easy
350. Intersection of Two Arrays II Python Easy
354. Russian Doll Envelopes Python Hard
355. Design Twitter Python Medium
371. Sum of Two Integers Python Easy
376. Wiggle Subsequence Python Medium
378. Kth Smallest Element in a Sorted Matrix Python Medium
387. First Unique Character in a String Python Easy
392. Is Subsequence Python Easy
394. Decode String Python Medium
402. Remove K Digits Python Medium
404. Sum of Left Leaves Python, C(++) Easy
405. Convert a Number to Hexadecimal Python Easy
406. Queue Reconstruction by Height Python Medium
409. Longest Palindrome Python Easy
416. Partition Equal Subset Sum Python Medium
417. Pacific Atlantic Water Flow Python Medium
421. Maximum XOR of Two Numbers in an Array Python Medium
437. Path Sum III Python Easy
438. Find All Anagrams in a String C(++) Medium
441. Arranging Coins Python Easy
442. Find All Duplicates in an Array Python Medium
443. String Compression Python Easy
445. Add Two Numbers II Python Medium
452. Minimum Number of Arrows to Burst Balloons Python Medium
454. 4Sum II Python, C(++) Medium
455. Assign Cookies Python Easy
458. Poor Pigs Python Hard
459. Repeated Substring Pattern Python Easy
461. Hamming Distance Python Easy
462. Minimum Moves to Equal Array Elements II Python Medium
463. Island Perimeter Python Easy
464. Can I Win Python Medium
465. Optimal Account Balancing Python Hard
473. Matchsticks to Square Python Medium
475. Heaters Python Easy
476. Number Complement Python Easy
477. Total Hamming Distance Python Medium
481. Magical String Python Medium
486. Predict the Winner Python Medium
496. Next Greater Element I Python Easy
504. Base 7 Python Easy
507. Perfect Number Python Easy
509. Fibonacci Number JavaScript Easy
513. Find Bottom Left Tree Value Python Medium
518. Coin Change 2 Python Medium
525. Contiguous Array Python Medium
526. Beautiful Arrangement Python Medium
530. Minimum Absolute Difference in BST C(++) Easy
542. 01 Matrix Python Medium
543. Diameter of Binary Tree Python Easy
547. Friend Circles Python, C(++) Medium
551. Student Attendance Record I Python Easy
554. Brick Wall Python Medium
559. Maximum Depth of N-ary Tree Python Easy
560. Subarray Sum Equals K Python Medium
561. Array Partition I Python Easy
566. Reshape the Matrix Python Easy
576. Out of Boundary Paths Python Medium
589. N-ary Tree Preorder Traversal Python Easy
590. N-ary Tree Postorder Traversal Python Easy
599. Minimum Index Sum of Two Lists Python Easy
606. Construct String from Binary Tree Python, C(++) Easy
617. Merge Two Binary Trees Python Easy
621. Task Scheduler C(++) Medium
628. Maximum Product of Three Numbers Python Easy
633. Sum of Square Numbers Python Easy
637. Average of Levels in Binary Tree C(++) Easy
648. Replace Words Python Medium
650. 2 Keys Keyboard Python Medium
652. Find Duplicate Subtrees Python, C(++) Medium
654. Maximum Binary Tree Python Medium
655. Print Binary Tree Python Medium
657. Robot Return to Origin Python Easy
665. Non-decreasing Array JavaScript Easy
669. Trim a Binary Search Tree Python Easy
671. Second Minimum Node In a Binary Tree Python Easy
673. Number of Longest Increasing Subsequence Python Medium
674. Longest Continuous Increasing Subsequence Python Easy
675. Cut Off Trees for Golf Event Python Hard
677. Map Sum Pairs Python Medium
680. Valid Palindrome II Python Easy
682. Baseball Game Python Easy
687. Longest Univalue Path Python Easy
690. Employee Importance Python Easy
692. Top K Frequent Words Python Medium
697. Degree of an Array Python Easy
701. Insert into a Binary Search Tree Python Medium
703. Kth Largest Element in a Stream Python Easy
704. Binary Search Python Easy
705. Design HashSet Python Easy
706. Design HashMap Python Easy
717. 1-bit and 2-bit Characters Python Easy
720. Longest Word in Dictionary Python Easy
724. Find Pivot Index Python Easy
728. Self Dividing Numbers Python Easy
733. Flood Fill Python Easy
743. Network Delay Time Python Medium
744. Find Smallest Letter Greater Than Target Python Easy
746. Min Cost Climbing Stairs Python Easy
748. Shortest Completing Word Python Easy
756. Pyramid Transition Matrix Python Medium
762. Prime Number of Set Bits in Binary Representation Python Easy
771. Jewels and Stones Python Easy
778. Swim in Rising Water C(++) Hard
784. Letter Case Permutation Python Easy
799. Champagne Tower Python Medium
801. Minimum Swaps To Make Sequences Increasing Python Medium
802. Find Eventual Safe States Python Medium
811. Subdomain Visit Count Python Easy
823. Binary Trees With Factors Python Medium
829. Consecutive Numbers Sum Python Hard
836. Rectangle Overlap Python Easy
841. Keys and Rooms Python Medium
857. Minimum Cost to Hire K Workers Python Hard
860. Lemonade Change Python Easy
871. Minimum Number of Refueling Stops Python, C(++) Hard
872. Leaf-Similar Trees Python Easy
883. Projection Area of 3D Shapes Python Easy
891. Sum of Subsequence Widths Python Hard
897. Increasing Order Search Tree Python, JavaScript Easy
905. Sort Array By Parity Python Easy
912. Sort an Array JavaScript Medium
930. Binary Subarrays With Sum Python Medium
931. Minimum Falling Path Sum Python Medium
958. Check Completeness of a Binary Tree Python Medium
965. Univalued Binary Tree Python Easy
987. Vertical Order Traversal of a Binary Tree JavaScript Medium
988. Smallest String Starting From Leaf Python Medium
1029. Two City Scheduling Python Easy
1046. Last Stone Weight Python Easy
1092. Shortest Common Supersequence Python Hard
1109. Corporate Flight Bookings Python Medium
1114. Print in Order C(++) Easy
1115. Print FooBar Alternately C(++) Medium
1129. Shortest Path with Alternating Colors Python Medium
1145. Binary Tree Coloring Game Python Medium
1160. Find Words That Can Be Formed by Characters Python Easy
1175. Prime Arrangements Python Easy
1202. Smallest String With Swaps Python Medium
1278. Palindrome Partitioning III Python Hard
1287. Element Appearing More Than 25% In Sorted Array Python Easy
1288. Remove Covered Intervals Python Medium
1289. Minimum Falling Path Sum II Python Hard
1290. Convert Binary Number in a Linked List to Integer Python Easy
1291. Sequential Digits Python Medium
1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold Python Medium
1293. Shortest Path in a Grid with Obstacles Elimination Python Hard
1295. Find Numbers with Even Number of Digits C(++) Easy
1296. Divide Array in Sets of K Consecutive Numbers Python Medium
1297. Maximum Number of Occurrences of a Substring Python Medium
1299. Replace Elements with Greatest Element on Right Side Python Easy
1300. Sum of Mutated Array Closest to Target Python Medium
1301. Number of Paths with Max Score Python Hard
1304. Find N Unique Integers Sum up to Zero Python Easy
1305. All Elements in Two Binary Search Trees Python Medium
1306. Jump Game III Python Medium
1312. Minimum Insertion Steps to Make a String Palindrome Python, C(++) Hard
1317. Convert Integer to the Sum of Two No-Zero Integers Python Easy
1319. Number of Operations to Make Network Connected Python Medium
1323. Maximum 69 Number Python Easy
1324. Print Words Vertically Python Medium
1325. Delete Leaves With a Given Value Python Medium
1326. Minimum Number of Taps to Open to Water a Garden Python Hard
1328. Break a Palindrome C(++) Medium
1329. Sort the Matrix Diagonally Python Medium
1330. Reverse Subarray To Maximize Array Value Python Hard
1331. Rank Transform of an Array C(++) Easy
1332. Remove Palindromic Subsequences Python Easy
1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance C(++) Medium
1337. The K Weakest Rows in a Matrix Python Easy
1338. Reduce Array Size to The Half Python Medium
1339. Maximum Product of Splitted Binary Tree Python Medium
1356. Sort Integers by The Number of 1 Bits Python Easy

Contribution

Use Github issues for requests.

We actively welcome pull requests, learn how to contribute.

About

learning algorithm with python and C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published