This repo is a collection of Java solutions to some LeetCode problems, with a bit of discussion included with each.
I formatted the code to run conveniently in my IDE. You may need to fiddle with
static
modifiers on classes and methods if you want to paste code into the
LeetCode UI verbatim.
The argument types and return types of the functions the LeetCode grader expects to call have been kept the same. Where alternative solutions are offered, the function names have been changed to distinguish them.
The common data types that LeetCode requires users to use have been factored out
into a separate package. I have only modified
these classes to add convenience methods, like toString()
, to make solutions
more easily testable.