Dear LeetCoders! For a better LeetCode problem-solving experience, please visit website LeetCode Python: Dare to claim the best practices of LeetCode solutions! Will save you a lot of time!
Hi there! I'm Lane. Do you feel that there are too many problems (over 3,450) on the LeetCode and you can't finish them all? Or do you forget how to solve the problems you did last time?
If you can master some solution patterns, this will happen less often.
Here, I will provide you with common problem-solving patterns so that you don't waste time on problems that are not often tested in interviews.
Python, C++, Java, JavaScript, C#, Go, Ruby languages' solutions are provided for every selected LeetCode problem. Other languages' solutions will be provided in the future. If you have better solutions, welcome to create an issue or PR!
Developer Portfolio focuses on bringing value to developers, including resume, portfolio, blog and other functions. With it, your abilities will be better seen by employers!
I have planned a learning route for you. You just need to do the problems in the order they are listed. You can skip the more difficult problems and do them later.
- 344. Reverse String Python, Java, C++, JavaScript, C#, Go, Ruby.
- 27. Remove Element Python, Java, C++, JavaScript, C#, Go, Ruby, 2 approaches.
- 704. Binary Search Python, Java, C++, JavaScript, C#, Go, Ruby.
- 977. Squares of a Sorted Array Python, Java, C++, JavaScript, C#, Go, Ruby.
- 209. Minimum Size Subarray Sum Python, Java, C++, JavaScript, C#, Go, Ruby.
- 303. Range Sum Query - Immutable Python, Java, C++, JavaScript, C#, Go, Ruby.
- 59. Spiral Matrix II Python, Java, C++, JavaScript, C#, Go, Ruby.
- 503. Next Greater Element II Python, Java, C++, JavaScript, C#, Go, Ruby.
- 3478. Choose K Elements With Maximum Sum Python.
- 203. Remove Linked List Elements Python, Java, C++, JavaScript, C#, Go, Ruby.
- 206. Reverse Linked List Python, Java, C++, JavaScript, C#, Go, Ruby.
- 160. Intersection of Two Linked Lists Python, Java, C++, JavaScript, C#, Go, Ruby.
- 19. Remove Nth Node From End of List Python, Java, C++, JavaScript, C#, Go, Ruby.
- 707. Design Linked List Python, Java, C++, JavaScript, C#, Go, Ruby.
- 24. Swap Nodes in Pairs Python, Java, C++, JavaScript, C#, Go, Ruby.
- 349. Intersection of Two Arrays Python, Java, C++, JavaScript, C#, Go, Ruby.
- 242. Valid Anagram Python, Java, C++, JavaScript, C#, Go, Ruby.
- 1. Two Sum Python, Java, C++, JavaScript, C#, Go, Ruby.
- 383. Ransom Note Python, Java, C++, JavaScript, C#, Go, Ruby.
- 202. Happy Number Python, Java, C++, JavaScript, C#, Go, Ruby.
- 454. 4Sum II Python, Java, C++, JavaScript, C#, Go, Ruby.
- 49. Group Anagrams Python, Ruby.
- 28. Find the Index of the First Occurrence in a String Python, Java, C++, JavaScript, C#, Go, Ruby.
- 541. Reverse String II Python, Java, C++, JavaScript, C#, Go, Ruby.
- 459. Repeated Substring Pattern Python, Java, C++, JavaScript, C#, Go, Ruby.
- 833. Find, Replace in String Python.
- 15. 3Sum Python, Java, C++, JavaScript, C#, Go, Ruby, 2 approaches.
- 18. 4Sum Python, Java, C++, JavaScript, C#, Go, Ruby.
- 20. Valid Parentheses Python, Java, C++, JavaScript, C#, Go, Ruby.
- 232. Implement Queue using Stacks Python, Java, C++, JavaScript, C#, Go, Ruby.
- 225. Implement Stack using Queues Python, Java, C++, JavaScript, C#, Go, Ruby, 3 approaches.
- 144. Binary Tree Preorder Traversal Python, 2 approaches.
- 509. Fibonacci Number Python, Java, C++, JavaScript, C#, Go, Ruby.
- 198. House Robber Python, Java, C++, JavaScript, C#, Go, Ruby.
- 213. House Robber II Python, Java, C++, JavaScript, C#, Go, Ruby.
- 337. House Robber III Python, Java, C++, JavaScript, C#, Go, Ruby, 2 approaches.
- 416. Partition Equal Subset Sum Python, Java, C++, JavaScript, C#, Go, Ruby, 2 approaches.
- 1049. Last Stone Weight II Python, Java, C++, JavaScript, C#, Go, Ruby, 2 approaches.
- 494. Target Sum Python, Java, C++, JavaScript, C#, Go, Ruby.
- 474. Ones and Zeroes Python, Java, C++, JavaScript, C#, Go, Ruby.
- 518. Coin Change II Python, Java, C++, JavaScript, C#, Go, Ruby.
- 377. Combination Sum IV Python, Java, C++, JavaScript, C#, Go, Ruby.
- 322. Coin Change Python, Java, C++, JavaScript, C#, Go, Ruby.
- 279. Perfect Squares Python, Java, C++, JavaScript, C#, Go, Ruby.
- 139. Word Break Python, Java, C++, JavaScript, C#, Go, Ruby.
- 121. Best Time to Buy and Sell Stock Python, JavaScript, Go.
- 122. Best Time to Buy and Sell Stock II Python, JavaScript, Go.
- 714. Best Time to Buy and Sell Stock with Transaction Fee Python, JavaScript, Go.
- 123. Best Time to Buy and Sell Stock III Python, JavaScript, Go.
- 188. Best Time to Buy and Sell Stock IV Python, JavaScript, Go.
- 309. Best Time to Buy and Sell Stock with Cooldown Python, JavaScript, Go.
- 674. Longest Continuous Increasing Subsequence Python, Java, JavaScript, C#.
- 300. Longest Increasing Subsequence Python, Java, JavaScript, C#.
- 718. Maximum Length of Repeated Subarray Python, Java, JavaScript, C#.
- 1143. Longest Common Subsequence Python, Java, C++, JavaScript, C#, Go, Ruby.
- 1035. Uncrossed Lines Python, Java, C++, JavaScript, C#, Go, Ruby.
- 53. Maximum Subarray Python, Java, C++, JavaScript, C#, Go, Ruby.
- 392. Is Subsequence Python, Java, C++, JavaScript, C#, Go, Ruby.
- 583. Delete Operation for Two Strings Python, Java, C++, JavaScript, C#, Go, Ruby.
- 72. Edit Distance Python, Java, C++, JavaScript, C#, Go, Ruby.
- 3494. Find the Minimum Amount of Time to Brew Potions Python, Java, C++, JavaScript, C#, Go, Ruby.
- 739. Daily Temperatures Python, Java, C++, JavaScript, C#, Go, Ruby.
- 496. Next Greater Element I Python, Java, C++, JavaScript, C#, Go, Ruby.
- 42. Trapping Rain Water Python, Java, C++, JavaScript, C#, Go, Ruby.
- 84. Largest Rectangle in Histogram Python, Java, C++, JavaScript, C#, Go, Ruby.
- 797. All Paths From Source to Target Python, Java, C++, JavaScript, C#, Go, Ruby, 2 approaches.
- 200. Number of Islands Python, Java, C++, JavaScript, C#, Go, Ruby, 3 approaches.
- 463. Island Perimeter Python, 2 approaches.
- 695. Max Area of Island Python, Java, C++, JavaScript, C#, Go, Ruby, 3 approaches.
- 827. Making A Large Island Python, 2 approaches.
- 127. Word Ladder Python.
- 1971. Find if Path Exists in Graph Python, Java, C++, JavaScript, C#, Go, Ruby, 2 approaches.
- 684. Redundant Connection Python, Java, C++, JavaScript, C#, Go, Ruby.
- 685. Redundant Connection II Python.
- 1584. Min Cost to Connect All Points Python, Java, C++, JavaScript, C#, Go, Ruby, 2 approaches.
- 207. Course Schedule Python, Java, C++, C#, 2 approaches.
- 1514. Path with Maximum Probability Python, 2 approaches.
- 752. Open the Lock Python, 2 approaches.
- 743. Network Delay Time Python, 2 approaches.
- 787. Cheapest Flights Within K Stops Python.
- 1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance Python.
- 433. Minimum Genetic Mutation Python, 3 approaches.
More LeetCode problems and solutions will be added soon. Updated every day.