Leetcode hints (for competitive coding)

Advanced hints for choosing data structures or algorithms

  • monotonic stack (单调栈): find next/previous greater/smaller XXX
  • backtracking (回溯): find all XXX
  • dynamic programming (动态规划): 可以使用回溯等手段暴力枚举所有解,但是题中只求计算数目或者存在性(不要求返回解的具体形式)。
  • fixed-sized priority queue / heap (固定大小的优先队列或堆): k-th smallest/largest element or top-k smallest/greatest elements