[笔记]LeetCode入门(漫谈常见题型与解法)

前言

涮题要义

Basic Knowledge

Data Structures

Data Structures Access Search Insert Delete
List O(1) O(n) O(1) O(n)
Set O(1) O(1) O(1) O(1)
Stack O(n) O(n) O(1) O(1)
Deque(double-ended queue) O(n) O(n) O(1) O(1)
Map O(1) O(1) O(1) O(1)

Algorithms

算法对应例题待补充

Arrays

  • Arrays Two pointers(sliding window)
  • Binary Search(sorted, search space)
  • Combined with Map(two sums) look up
  • Prefix sum(dp) subarray
  • Quick select(kth)

Stacks

  • Maxinum Rectangle
  • Next Greater Elements
  • Trapping Rain Water

Queues

  • BFS

Graphs

  • DFS
  • BFS
  • Dijkstra’s

Backtracking

  • permutaion
  • subsets
  • combination sum
    • Partiton Equal
    • subset sum
  • N-Queens
  • Sudoku

Dynamic Programming

keyword: total ways True|False Max|Min

  • 0/1 knapsask
    • coin changes
    • perfect squares
  • climbing stairs(decode ways)
  • string related
    • regular expressing matching
    • wildcard matching
    • edit distance
    • LIS/LCS
  • 2D matrix
    • maxinum squares
    • range sum query
    • bomb enemy
    • unique paths

Greedy

  • Top K
  • campus bikes
  • merge k sorted lists

Refenrece

© 2025 · Built with Gatsby