Skip to content

palemoky/leetcode

Repository files navigation

LeetCode Solutions

Test Docs License: MIT License: CC BY 4.0

Computer science is no more about computers than astronomy is about telescopes. — E. W. Dijkstra


Essential Algorithm Fundamentals

Algorithm Basics You Must Master:

  1. Linked List: traversal, reversal, merging, cycle detection
  2. Binary Tree: level order(max/min depth, symmetric tree), preorder/inorder/postorder traversal (both recursive and iterative), inversion, lowest common ancestor, merge two binary trees
  3. Sorting: quick sort, merge sort, insertion sort, selection sort, bubble sort, heap sort
  4. Binary Search: on sorted arrays, binary trees
  5. Bit Manipulation Techniques:
    • XOR (^): find numbers that appear only once or twice.
    • AND (&):
      • n & (n-1): removes the lowest set bit, commonly used to check if a number is a power of 2.
      • n & -n: gets the lowest set bit.
    • << and >>: efficient multiplication and division by 2.
    • Use XOR to find the unique unpaired number.
  6. Math Techniques: fast exponentiation, GCD/LCM, elementary math simulation

Core Algorithm Ideas:

  1. Hash table: trading space for time
  2. Two pointers: fast/slow pointers, left/right pointers (collision pointers), sliding window
  3. DFS: using a stack
  4. BFS/backtracking: using a queue
  5. Dynamic Programming (DP)

Must-Know Classic LeetCode Problems by Category

  1. Arrays & Strings
  1. Linked Lists
  1. Stacks & Queues
  1. Hash Tables
  1. Binary Search
  1. Dynamic Programming
  1. Backtracking
  1. Trees & Recursion
  1. Graphs (BFS & DFS)
  1. Greedy Algorithms
  1. Math & Bit Manipulation

Visualization Algorithm Tools

Algorithm Learning Resources


📄 License

This project is dual-licensed:

Feel free to use, modify, and share this project. Attribution is appreciated! ❤️

About

🥷 LeetCode Solutions

Topics

Resources

License

Stars

Watchers

Forks