/leetcode

Primary LanguagePython

leetcode

This repository contains my solutions to some of the problems from LeetCode. The solutions are organized by problem categories.

Table of Contents

How to Use

  1. Clone the repository:
    git clone https://github.com/lynxrv21/leetcode.git
  2. Get random problem to solve:
    python generate_problem.py
    Optionally, specify complexity or specific problem name:
    python get_problem.py [-h] [-c {easy,medium,hard}] [-p PROBLEM]
  3. New template file will be generated, with problem description and test cases

Directory Structure

leetcode/
├── arrays
│   ├── 001_two_sum.py
│   ├── 015_3sum.py
│   ├── 121_best_time_to_buy_and_sell_stock.py
│   ├── 217_contains_duplicate.py
│   ├── 242_valid_anagram.py
│   └── utils.py
├── linked_lists
│   ├── 002_add_two_numbers.py
│   ├── 021_merge_two_sorted_lists.py
│   ├── 141_linked_list_cycle.py
│   ├── 206_reverse_linked_list.py
│   └── utils.py
├── stack
│   └── 020_valid_parentheses.py
├── trees
│   ├── 100_same_tree.py
│   ├── 104_maximum_depth_of_binary_tree.py
│   ├── 226_invert_binary_tree.py
│   └── utils.py
├── two_pointers
│   └── 125_valid_palindrome.py
├── Makefile
├── README.md
├── get_problem.py
├── leetcode.py
└── run_tests.py

Problem List

Arrays

Linked Lists

Stack

Trees

Two Pointers

Resources

NeetCode - coding challenges and some courses

System Design Primer - Guide to system design interviews

TechDummies - System design video guides

gkcs - Another system design and algorithms YT channel

Grokking the System Design Interview - Online course (paid)

Contributing

Contributions are welcome! If you have solutions or improvements to existing ones, feel free to submit a pull request. Please check the code before submitting:

python run_tests.py
pip install black ruff
make fmt