Skip to content

Latest commit

 

History

History

README.md

Python Algorithms Collection

A comprehensive collection of 1400+ algorithm implementations in Python, primarily consisting of LeetCode solutions.

Directory Structure

python/
├── arrays/              # Array manipulation problems (880 problems)
├── backtracking/         # Backtracking algorithms (10 problems)
├── bit_manipulation/     # Bit manipulation problems (12 problems)
├── design/              # System design problems (31 problems)
├── dynamic_programming/ # Dynamic programming solutions (142 problems)
├── graphs/              # Graph algorithms (41 problems)
├── greedy/              # Greedy algorithms (9 problems)
├── hash_table/          # Hash table solutions (5 problems)
├── heap/                # Heap/Priority queue (5 problems)
├── linked_lists/        # Linked list problems (69 problems)
├── math/                # Mathematical problems (40 problems)
├── misc/                # Uncategorized problems (133 problems)
├── queue/               # Queue-based problems (7 problems)
├── recursion/          # Recursion problems (3 problems)
├── sliding_window/     # Sliding window problems (1 problem)
├── stack/              # Stack-based problems (7 problems)
├── strings/            # String manipulation (227 problems)
├── trees/              # Tree data structure problems (191 problems)
└── two_pointers/       # Two pointers technique (5 problems)

Usage

Import algorithms from specific categories:

from arrays.two_sum import Solution as TwoSum
from trees.binary_tree_inorder_traversal import Solution as InorderTraversal
from dynamic_programming.climbing_stairs import Solution as ClimbingStairs

Categories

Arrays (880 problems)

  • Two/Three/Four sum
  • Remove duplicates
  • Search (binary search)
  • Rotate array
  • Merge intervals
  • Product of array except self
  • And many more...

Strings (227 problems)

  • Palindrome problems
  • String matching
  • Encoding/decoding
  • Anagrams
  • And many more...

Trees (191 problems)

  • Binary tree traversals
  • BST operations
  • Tree construction
  • Lowest common ancestor
  • And many more...

Dynamic Programming (142 problems)

  • Fibonacci
  • House robber
  • Coin change
  • Longest subsequence
  • And many more...

Graphs (41 problems)

  • BFS/DFS
  • Shortest path
  • Topological sort
  • And many more...

Linked Lists (69 problems)

  • Reverse linked list
  • Merge sorted lists
  • Detect cycle
  • And many more...

Running Tests

pytest

License

MIT