Member-only story

Leetcode’s Top 15 Algorithms & Their Common Problems

btd
44 min readDec 8, 2023

--

LeetCode patterns refer to common techniques or approaches used to solve programming problems on the LeetCode platform. While there isn’t an official, universally accepted list of LeetCode patterns, the following are some commonly recognized patterns that can be helpful for solving a wide range of problems:

  1. Two Pointers: Used to efficiently solve problems with pointers that move towards each other or in opposite directions.
  2. Sliding Window: Involves maintaining a subset of elements within a fixed-size window as it slides through an array or sequence.
  3. Binary Search: A classic searching algorithm for finding an element in a sorted array or performing operations on a sorted list.
  4. Depth-First Search (DFS): A traversal technique where you go as deep as possible down one branch before backtracking.
  5. Breadth-First Search (BFS): A traversal technique where you visit all the neighbors of a node before moving on to the next level of nodes.
  6. Dynamic Programming (DP): Solving problems by breaking them down into smaller overlapping subproblems and storing the solutions to these subproblems to avoid redundant computations.
  7. Greedy Algorithms: Making locally optimal choices at each stage with the hope of finding a global…

--

--

btd
btd

No responses yet