Leetcode a day keeps unemployment away.
-A wise man on the internet
A repository of my solutions to LeetCode problems in various languages, complete with short explanatory writeups.
DISCLAIMER: While the code has been vetted by LeetCode's online judge (unless specified otherwise), my write-ups may contain wrong information. I am not and don't claim to be an expert on theoretical computer science and algorithms.
All problems can be found under the Problems directory. Each problem has its own directory, and under it, exist directories for each language it was solved in.
The directory name for each problem follows the format number. (difficulty) title. number is the 4 digit(zero padded) problem number, difficulty is the problem difficulty(single uppercase letter; E for easy, M for medium, H for hard), and title is the title of the problem.
Code that has solution as the prefix in its filename is guaranteed to be accepted by LeetCode's online judge(at the time it was committed); implementations that fail will be named as TLE or MLE, depending on why they were rejected. Also note that all complexity analyses stated in the writeups are worst case complexities.
If you ever decide to fork this repo to use it for yourself, a new problem or language can be added with new_problem.sh by supplying it with the problem number, difficulty, problem title, and language, in that order. A directory to the problem implementation will be created if it does not exist, and the template README_template_body.md will be copied into it, as well as an empty file corresponding to the specified language, if it is supported.
The following command adds an empty JavaScript template for the problem Longest Valid Parentheses:
./new_problem.sh 32 H "Longest Valid Parentheses"
Which creates the directory ./Problems/0032. (H) Longest Valid Parentheses/JavaScript containing files README.md and solution.js.