This repo contains my solutions to the problems of LeetCode, an online judge platform for preparing technical coding interviews. The problem statements can be found here. All the solutions are written in Java.
The solutions to a given problem are put in a separate folder bearing the same name as that problem.
For most of the problems, there is a single solution in a file named Solution.java
.
For some problems, there exist multiple solutions in files Solution_<method>.java
, where <method>
is a descriptive keyword to distinguish different approaches.
Some problems use custom structs.
The definitions of these structs as classes are originally given in the code template as comments at the top.
I removed them to keep my codes cleaner.
(I seldom put comments in my code unless truly necessary)
Instead, I put all the definition classes in the folder util/
.
This also makes it easier for local debugging.
Some of my solutions may not be optimal in either memory or time efficiency. If you have found a better solution to any problems, you are welcome to post your solution by making a pull request. I will merge it into the repo with full attribution once I have them reviewed.
See this wiki page to view status for each problem.