Welcome to my LeetCode Solutions repository! This project contains my solutions to various LeetCode problems implemented in Java.
Each problem has its own Java package named after the problem's number in the format S0000.
Inside each package is all of the needed code, as well as a Problem.md file containing the problem description.
Feel free to explore and learn from the implementations.
Contributions are welcome! If you have a more efficient solution or want to add solutions to new problems, feel free to create a pull request.
Number | Title | Runtime | Memory | Problem description |
---|---|---|---|---|
1 | Two Sum | 2 ms | 44.5 MB | Problem |
2 | Add Two Numbers | 2 ms | 45 MB | Problem |
3 | Longest Substring Without Repeating Characters | 6 ms | 44.4 MB | Problem |
4 | Median of Two Sorted Arrays | 1 ms | 45.7 MB | Problem |
9 | Palindrome Number | 7 ms | 44.4 MB | Problem |
13 | Roman to Integer | 11 ms | 45.2 MB | Problem |
14 | Longest Common Prefix | 3 ms | 41.6 MB | Problem |
20 | Valid Parentheses | 1 ms | 41.3 MB | Problem |
21 | Merge Two Sorted Lists | 8 ms | 43.1 MB | Problem |
26 | Remove Duplicates from Sorted Array | 1 ms | 44.7 MB | Problem |
27 | Remove Element | 0 ms | 41.8 MB | Problem |
28 | Find the Index of the First Occurrence in a String | 0 ms | 42 MB | Problem |
35 | Search Insert Position | 0 ms | 43.2 MB | Problem |
58 | Length of Last Word | 0 ms | 41.7 MB | Problem |
66 | Plus One | 0 ms | 41.4 MB | Problem |
67 | Add Binary | 1 ms | 42.4 MB | Problem |
69 | Sqrt(x) | 1 ms | 40.9 MB | Problem |
70 | Climbing Stairs | 1 ms | 39.8 MB | Problem |
75 | Sort Colors | 1 ms | 41.5 MB | Problem |
83 | Remove Duplicates from Sorted List | 0 ms | 43.5 MB | Problem |
88 | Merge Sorted Array | 0 ms | 41.8 MB | Problem |
94 | Binary Tree Inorder Traversal | 0 ms | 41.3 MB | Problem |
121 | Best Time to Buy and Sell Stock | 1 ms | 61.6 MB | Problem |
125 | Valid Palindrome <- Could improve | 15 ms | 44.8 MB | Problem |
136 | Single Number | 1 ms | 45.77 MB | Problem |
206 | Reverse Linked List | 1 ms | 42.4 MB | Problem |
344 | Reverse String | 0 ms | 48.4 MB | Problem |
350 | Intersection of Two Arrays II | 6 ms | 44.8 MB | Problem |
409 | Longest Palindrome | 6 ms | 42.4 MB | Problem |
506 | Relative Ranks <- Needs work! | 27 ms | 45.4 MB | Problem |
633 | Sum of Square Numbers | 5 ms | 40.8 MB | Problem |
648 | Replace Words | 686 ms | 53 MB | Problem |
786 | K-th Smallest Prime Fraction <- Needs work! | 672 ms | 106.5 MB | Problem |
826 | Most Profit Assigning Work | 11 ms | 46 MB | Problem |
846 | Hand of Straights | 59 ms | 45.5 MB | Problem |
945 | Minimum Increment to Make Array Unique | 38 ms | 60 MB | Problem |
1002 | Find Common Characters | 12 ms | 44.8 MB | Problem |
1122 | Relative Sort Array | 3 ms | 42.4 MB | Problem |
1296 | Divide Array in Sets of K Consecutive Numbers | 133 ms | 56.8 MB | Problem |
1509 | Minimum Difference Between Largest and Smallest Value in Three Moves | 15 ms | 57.39 MB | Problem |
1550 | Three Consecutive Odds | 0 ms | 41.98 MB | Problem |
1791 | Find Center of Star Graph | 0 ms | 66.5 MB | Problem |
2037 | Minimum Number of Moves to Seat Everyone | 2 ms | 44.3 MB | Problem |
2441 | Largest Positive Integer That Exists With Its Negative | 5 ms | 44.5 MB | Problem |
2486 | Append Characters to String to Make Subsequence | 3 ms | 45.3 MB | Problem |
2487 | Remove Nodes From Linked List | 8 ms | 63.5 MB | Problem |
2678 | Number of Senior Citizens | 0 ms | 42.34MB | Problem |
2816 | Double a Number Represented as a Linked List | 6 ms | 45.6 MB | Problem |
3075 | Maximize Happiness of Selected Children <- Needs work! | 34 ms | 61.1 MB | Problem |