130-SECOND TRIAGE
// ask these 3 on EVERY problem — they pin ~90% of approaches before you write a line
① INPUT SHAPE
What am I given?
The structure suggests the toolset. Sorted? almost always means two-pointers or binary search.
→ look it up in the Shape Map (§3)
② CONSTRAINT n
How big is n?
The most reliable tell. n fixes your target complexity, which fixes the technique class.
→ read it off the Oracle (§2)
③ WORDING
What phrase does the problem use?
"Number of ways", "top k", "next greater" — exact phrasing is a near-deterministic tell.
→ scan the Keyword Map (§4)
2CONSTRAINT → COMPLEXITY ORACLE
// n tells you the target O() — pick the biggest class that still fits
| n (input size) | target time | that means… |
| n ≤ 10–12 | O(n!) | permutations · full brute backtracking |
| n ≤ 18–22 | O(2ⁿ) | subsets · bitmask DP · meet-in-the-middle |
| n ≤ 100–500 | O(n³) | Floyd–Warshall · interval DP · triple loop |
| n ≤ 2,000–5,000 | O(n²) | grid / 2-D DP · all-pairs nested loops |
| n ≤ 10⁵ | O(n log n) | sort · heap · binary search · divide & conquer · segment tree |
| n ≤ 10⁶ | O(n) / O(n log n) | sliding window · two pointers · prefix sum · monotonic stack · hashing |
| n ≥ 10⁷–10⁸ | O(n) | single tight linear pass · counting · no per-element log |
| value ≤ 10⁹–10¹⁸ (not array size) | O(log V) | binary search on the answer · math · bit tricks |
Rule of thumb: ≈ 1e8 simple ops/sec in the room → compute n^? and compare to 1e8.
· Space: O(n) aux is usually free; watch recursion depth (stack overflow at ~1e5 deep) and any "in-place / O(1) space" follow-up.
3SHAPE → TECHNIQUE
// click a technique to highlight its pattern card (§5)
INPUT — what you're given
OUTPUT — what you must return
4KEYWORD → TECHNIQUE
// click a row to highlight its pattern card (§5) · these phrases are near-deterministic tells
5PATTERN MAP
// click a row for the code skeleton · ↳ depth links to the topic's full sheet
6RITUAL + OPTIMIZATION LEVERS
// the loop you run out loud, and how to break the brute force
🔧 WHERE'S THE REPEATED WORK? → LEVER
7STUCK? ESCALATION LADDER
// run top to bottom — never sit silent