Skip to the content.

Here is the list of solved problems. Language images are clickable and lead to the solution file.

No. Description (link to Leetcode) Explanation Lang
2 M Add Two Numbers  
3 M Longest Substring Without Repeating Characters  
5 M Longest Palindromic Substring  
7 M Reverse Integer  
13 E Roman to Integer  
25 H Reverse Nodes in k-Group  
30 H Substring with Concatenation of All Words  
33 M Search in Rotated Sorted Array  
34 M Find First and Last Position of Element in Sorted Array  
35 E Search Insert Position  
41 H First Missing Positive  
50 M Pow(x, n)  
60 H Permutation Sequence  
62 M Unique Paths  
67 E Add Binary  
69 E Sqrt(x)  
74 M Search a 2D Matrix  
86 M Partition List  
88 E Merge Sorted Array  
89 M Gray Code  
92 M Reverse Linked List II  
102 M Binary Tree Level Order Traversal  
114 M Flatten Binary Tree to Linked List  
118 E Pascal’s Triangle  
119 E Pascal’s Triangle II  
136 E Single Number  
137 M Single Number II  
153 M Find Minimum in Rotated Sorted Array  
167 M Two Sum II - Input Array Is Sorted  
172 M Factorial Trailing Zeroes  
200 M Number of Islands  
202 E Happy Number  
204 M Count Primes  
206 E Reverse Linked List  
215 M Kth Largest Element in an Array  
234 E Palindrome Linked List  
235 E Lowest Common Ancestor of a Binary Search Tree  
236 M Lowest Common Ancestor of a Binary Tree  
240 M Search a 2D Matrix II  
242 E Valid Anagram  
260 M Single Number III  
263 E Ugly Number  
264 M Ugly Number II  
278 E First Bad Version  
279 M Perfect Squares  
304 M Range Sum Query 2D - Immutable  
307 M Range Sum Query - Mutable  
315 H Count of Smaller Numbers After Self  
326 E Power of Three  
342 E Power of Four  
350 E Intersection of Two Arrays II  
367 E Valid Perfect Square  
374 E Guess Number Higher or Lower  
377 M Combination Sum IV  
378 M Kth Smallest Element in a Sorted Matrix  
383 E Ransom Note  
387 E First Unique Character in a String  
429 M N-ary Tree Level Order Traversal  
441 E Arranging Coins  
462 M Minimum Moves to Equal Array Elements II  
623 M Add One Row to Tree  
633 M Sum of Square Numbers  
637 E Average of Levels in Binary Tree  
668 H Kth Smallest Number in Multiplication Table  
695 M Max Area of Island  
704 E Binary Search  
729 M My Calendar I  
733 E Flood Fill  
744 E Find Smallest Letter Greater Than Target  
786 M K-th Smallest Prime Fraction  
804 E Unique Morse Code Words  
814 M Binary Tree Pruning  
852 M Peak Index in a Mountain Array  
858 M Mirror Reflection  
867 E Transpose Matrix  
871 H Minimum Number of Refueling Stops  
890 M Find and Replace Pattern  
967 M Numbers With Same Consecutive Differences  
985 M Sum of Even Numbers After Queries  
987 H Vertical Order Traversal of a Binary Tree  
1020 M Number of Enclaves  
1048 M Longest String Chain  
1175 E Prime Arrangements  
1250 H Check If It Is a Good Array  
1254 M Number of Closed Islands  
1332 E Remove Palindromic Subsequences  
1337 E The K Weakest Rows in a Matrix  
1338 M Reduce Array Size to The Half  
1346 E Check If N and Its Double Exist  
1351 E Count Negative Numbers in a Sorted Matrix  
1385 E Find the Distance Value Between Two Arrays  
1423 M Maximum Points You Can Obtain from Cards  
1447 M Simplified Fractions  
1448 M Count Good Nodes in Binary Tree  
1480 E Running Sum of 1d Array  
1539 E Kth Missing Positive Number  
1608 E Special Array With X Elements Greater Than or Equal X  
1647 M Minimum Deletions to Make Character Frequencies Unique  
1680 M Concatenation of Consecutive Binary Numbers  
1689 M Partitioning Into Minimum Number Of Deci-Binary Numbers  
1710 E Maximum Units on a Truck  
1855 M Maximum Distance Between a Pair of Values  
2091 M Removing Minimum and Maximum From Array  
2147 H Number of Ways to Divide a Long Corridor  
2183 H Count Array Pairs Divisible by K  
2197 H Replace Non-Coprime Numbers in Array  
2280 M Minimum Lines to Represent a Line Chart  
2478 H Number of Beautiful Partitions  

Basic algorithm implementations

Binary indexed tree (Fenwick tree)

No. Solutions where implemented Lang Notes
315 Count of Smaller Numbers After Self Tree for counting numbers less than X
No. Solutions where implemented Lang Notes
34 Find First and Last Position of Element in Sorted Array Search for leftmost and rightmost in series of equals
35 Search Insert Position Search for leftmost
74 Search a 2D Matrix Simple search with linear indexing of 2D matrix
240 Search a 2D Matrix II Simple search
704 Binary Search Simple search

Greatest common divisor (GCD)

No. Solutions where implemented Lang Notes
1447 Simplified Fractions  
2280 Minimum Lines to Represent a Line Chart  

Single-linked list

No. Solutions where implemented Lang Notes
25 Reverse Nodes in k-Group  
92 Reverse Linked List II  

Factorization

No. Solutions where implemented Lang Notes
279 Perfect Squares Simple factorization

Other helpers

Helper Solution Lang
Py implementation of ListNode’s __str__ and __repr__ 25. Reverse Nodes in k-Group
Building TreeNode’s tree from array 623. Add One Row to Tree
Dynamic array 637. Average of Levels in Binary Tree
Swift queue using single-linked list 695. Max Area of Island
Building TreeNode’s tree from array 814. Binary Tree Pruning