cswork / templatesOpen the Line 500 list

LINE 500 · 35 STOPS · 4 LANGUAGES

A code template for every stop.

The 500 curated problems run as one line of 35 topic stops. Each stop has a one-page cheat sheet: three key points, three common pitfalls and a runnable template in Python, C++, Java and Go.

Prerequisite graphHow the 35 stops build on each other, plus the system design and behavioral tracks.Core Skills: data structures by hand36 problems: build hash maps, heaps, an LRU cache, sorts, shortest paths, union-find, segment trees and more without libraries, plus multithreaded concurrency and object-oriented design (LLD) problems, judged in four languages.Chinese–English algorithm glossaryAlgorithm terms in both languages, each with an interview sentence to listen to or turn into a review card.

More dots: more interview reports map onto the stop.

Linear Structures01–08

  1. Stop 01: In-place Arrays, interview heat 1 of 3Read/write pointers for in-place compaction
  2. Stop 02: Hashing, interview heat 1 of 3One-pass hash map lookup
  3. Stop 03: Strings, interview heat 1 of 3KMP prefix function
  4. Stop 04: Two Pointers, interview heat 2 of 3Variable-size sliding window
  5. Stop 05: Prefix & Ranges, interview heat 2 of 3Prefix sums with a hash count
  6. Stop 06: Binary Search, interview heat 1 of 3First true on a half-open range
  7. Stop 07: Stacks & Heaps, interview heat 3 of 3Monotonic stack: next greater element
  8. Stop 08: Greedy, interview heat 1 of 3Sort by end time, keep what fits

Lists & Trees09–13

  1. Stop 09: Linked Lists, interview heat 1 of 3Reverse in place, fast and slow pointers
  2. Stop 10: Tree Traversal, interview heat 1 of 3Level-order BFS
  3. Stop 11: Tree Paths, interview heat 1 of 3Return the one-sided gain, record the bent path globally
  4. Stop 12: Tree Building, interview heat 1 of 3Preorder picks the root, inorder splits the sides
  5. Stop 13: BST, interview heat 1 of 3Iterative inorder walks a BST in sorted order

Graphs14–18

  1. Stop 14: Grid Search, interview heat 2 of 3Multi-source BFS, one ring per step
  2. Stop 15: Union-Find, interview heat 1 of 3Union-find with path compression and union by size
  3. Stop 16: Topo Sort, interview heat 1 of 3Kahn's algorithm: dequeue zero in-degree nodes
  4. Stop 17: Shortest Paths, interview heat 1 of 3Dijkstra with a heap and lazy deletion
  5. Stop 18: Spanning TreesKruskal: sort the edges, join with union-find

Backtracking19–21

  1. Stop 19: Enumeration, interview heat 1 of 3Choose, recurse, undo; skip duplicates on the same level
  2. Stop 20: Partitioning, interview heat 1 of 3Backtrack over cut points with a palindrome table
  3. Stop 21: Pruning, interview heat 1 of 3N-Queens: prune by column and both diagonals

Dynamic Programming22–31

  1. Stop 22: DP Basics, interview heat 1 of 31-D DP with rolling variables
  2. Stop 23: Grid DP, interview heat 1 of 3Grid DP compressed to one row
  3. Stop 24: Knapsack, interview heat 1 of 30/1 knapsack backwards, unbounded forwards
  4. Stop 25: Subsequences, interview heat 1 of 3LIS with a tails array and binary search
  5. Stop 26: String DP, interview heat 1 of 3Two-string DP over prefixes
  6. Stop 27: Palindromes, interview heat 1 of 3Interval DP with the left end running backwards
  7. Stop 28: State Machines, interview heat 1 of 3Ending-at-i states: track both max and min
  8. Stop 29: Stock Trading, interview heat 1 of 3Three states: holding, cooling down, free
  9. Stop 30: Scheduling DPSort by end, binary search the last compatible job
  10. Stop 31: Tree & Game DP, interview heat 1 of 3Tree DP: each node returns (take, skip)

Design & Bits32–35

  1. Stop 32: Iterators, interview heat 1 of 3Lazy iterator: hasNext does the advancing
  2. Stop 33: Caches, interview heat 3 of 3LRU: hash map plus doubly linked list
  3. Stop 34: Trie & Codec, interview heat 1 of 3Trie nodes hold children and counts
  4. Stop 35: Bits & Math, interview heat 1 of 3Bit tricks and fast power