Week 05 — Jun 22–28, 2026 — Tries + Heap (compressed)
Week 05 (Jun 22 – Jun 28, 2026) — TRIES + HEAP (compressed)
SPRINT S1 of 8 (Jun 22 – Aug 15). New plan: finish all DSA + HLD/SD problems + Redis playlist by Aug 15, then apply mid-Aug. This week: Tries (3) + Heap (7) = 10 problems. Timer on, solo, no hints until timer expires.
→ Full curriculum: [[Coach/project_dsa_sd_curriculum]] → Coach state: [[synthesis/Coach Hub]]
Decisions applied this week (Vatsal, Jun 21)
- Applications + referral DMs → moved to AUGUST. Tracked here, no gate this week. (Risk flagged: 90-day notice + Aug apps → offers ~Dec, tight vs Nov 11 target.)
- DDIA → merged into SD track. No longer a separate marathon. SD-theory slot only, ongoing reading.
- DSA → compress + slip 1 week. Tries + full Heap this week.
- STAR reps → dropped from weekly gate. Resume before first screen.
Goals This Week
- 10 DSA problems — done Wed Jun 24 (4 days early). 8/10 on time (621, 355 fail). ✅
- Re-drill 2 misses — LC 23→355 merge + 621 formula (scheduled Fri Jun 26 review day)
- SD problem: URL Shortener — ⏭️ deferred (did Rate Limiter S2 instead, 2026-07-02). Pick up URL Shortener next.
- Redis: Intro + data types
- DDIA: Ch6 Replication pt1 (lunch slot)
- Sun Jun 28 scorecard + S2 direction set
DSA Problem Set (10)
Rules: timer on, no editorial/AI/peek until timer expires. One sitting per problem. Mark fail if timer expires.
| # | Pattern | Problem | LC | Diff | Target | Solved? | Time | Bugs / notes |
|---|---|---|---|---|---|---|---|---|
| 1 | Tries | Implement Trie (Prefix Tree) | 208 | M | 25 min | Yes | 6:00 | Canonical, senior bar. Polish: extract `_find(prefix)→node |
| 2 | Tries | Design Add and Search Words | 211 | M | 30 min | Yes | 13:00 | Senior bar. Reused _find helper (applied 208 feedback). .→DFS branch. Nit: any([..])→any(.. ) generator for short-circuit + no list build. start-index avoids slice copies. |
| 3 | Tries | Word Search II | 212 | H | 45 min | Yes | 24:00 | Senior bar — fully optimized. Trie-in-lockstep DFS + leaf-prune (del node.children[ch]) + '#' visited + is_end=False dedup + edge-word handling. Nits: mixed tuple/list dirs; matched set redundant given is_end reset. Tries bucket 3/3. |
| 4 | Heap | Kth Largest Element in a Stream | 703 | E | 15 min | Yes | 3:00 | Senior bar. Min-heap size k, root=kth largest. heapify O(n)+trim init, add O(log k). heapq reflex cleared (W2 flag closed). |
| 5 | Heap | Last Stone Weight | 1046 | E | 15 min | Yes | 7:30 | Senior bar. Negate for max-heap; correct sign y-x (y more negative=larger). Trim: if x!=y: push(y-x) drops continue/else. |
| 6 | Heap | K Closest Points to Origin | 973 | M | 25 min | Yes | 9:00 | Senior bar. Max-heap size k, O(n log k). Nit: drop math.sqrt — compare squared dist (exact int, no float). Tie falls through to list compare (works, incidental). Alts: nsmallest, quickselect O(n). |
| 7 | Heap | Kth Largest Element in an Array | 215 | M | 25 min | Yes | 5:00 | Senior bar (heap). Negate+heapify O(n)+pop k → O(n+k log n). Trim: pop k-1 then peek root. TODO: write quickselect O(n) cold (shared w/ 347, 973). |
| 8 | Heap | Task Scheduler | 621 | M | 30 min | Fail | 43:30 | Simulation correct (heap+cooldown queue, math sound) but 13 min OVER. Reached for simulation when O(N) FORMULA is canonical: max(len(tasks), (max_freq-1)*(n+1) + num_max). Drill the formula — frequency+cooldown-layout pattern. First miss of week. |
| 9 | Heap | Design Twitter | 355 | M | 35 min | Fail* | 36:00 | Correct + OPTIMAL design (lazy k-way merge, self-follow, O(10 log F)). But over time + needed HINTS on getNewsFeed. Merge pattern (seed heap, pop-then-push-next) not reflex — SAME gap as LC 23 (W2, also taught). DRILL 23+355 back-to-back. Ties to S3 Twitter Feed SD (fan-out read vs write). |
| 10 | Heap | Find Median from Data Stream | 295 | H | 40 min | Yes | 9:00 | Senior bar, textbook. Two-heap push-low→pop-to-high→rebalance auto-sorts boundary (no num-vs-top compare). low holds extra on odd. O(log n) add, O(1) median. Solo, no hints — clean close-out. |
Score: __/10 on time
Heap prereq: heapq API pre-loaded (flagged W2 fix — verify
heappush/heappop/nlargest/heapifyreflex before Q4).
SD + Redis Tracker (DDIA folded in)
| Item | Status | Notes |
|---|---|---|
| SD problem: URL Shortener | ⬜ | First design problem. Components: hash/base62, KGS, DB choice, cache, redirect path, analytics. |
| Redis playlist: Intro + data types | ⬜ | strings/hash/list/set. S1 of 7-week Redis arc (done by S7). |
| DDIA reading (lunch slot) | ⬜ | Ch3 next. 1 chapter / 2 wks pace. |
Applications / Referrals — DEFERRED TO AUGUST
| Item | Original plan | New plan |
|---|---|---|
| 10 referral DMs (Splunk 5 + Amazon 5) | W3 mandatory | Aug W1 |
| First 5 apps | W3 | Aug W1 |
| Cold apps batch | W5+ | Aug |
Nothing required this week. Pipeline opens August.
Daily Plan
Mon Jun 22
- Tries theory block (~1h) — prefix tree structure, insert/search/startsWith, DFS-on-board for 212 ✅ 2026-06-21
- LC 208 (25 min) ✅ 2026-06-21
- Target: 2h
Tue Jun 23
- LC 211, 212 (~75 min + review) ✅ 2026-06-21
- Target: 2.5h
Wed Jun 24 ← TODAY
- Heap theory block (~45 min) ✅ 2026-06-23
- LC 703 (3:00), 1046 (7:30) ✅
- LC 973 (9:00), 215 (5:00) ✅ — pulled forward
- LC 621 (43:30 FAIL), 355 (36:00 FAIL*) ✅ attempted — pulled forward
- LC 295 (9:00, solo) ✅ — bucket complete
- PENDING TODAY: start SD URL Shortener (requirements + scale estimate) and/or Redis intro if energy left. DSA done — no problems owed today.
Thu Jun 25
- SD: URL Shortener — requirements + high-level (~1h)
- Redis: Intro + data types
- Target: 2.5h
Fri Jun 26
- Merge-pattern re-drill (review day): LC 23 Merge k Sorted Lists → LC 355 getNewsFeed back-to-back, solo, NO hints. Goal: seed-heap + pop-then-push-next is reflex. (Gap hit twice — W2 LC23 + S1 LC355.)
- 621 formula cold: rewrite Task Scheduler as
max(len, (max_freq-1)*(n+1)+num_max)from memory. - SD: URL Shortener — deep dive + trade-offs (~1h)
- Target: 2.5h
Sat Jun 27 — heavy
- LC 295 (hard, two-heap)
- URL Shortener full whiteboard cold (45 min, solo)
- Review any misses
- Target: 4h
Sun Jun 28 — retro
- Scorecard + W6 direction (
/coach scorecard) - Target: 1.5h
Decision Gate (Sun Jun 28)
| Score on time | Verdict | S2 plan (Jun 29–Jul 5) |
|---|---|---|
| 8–10 | Pass — strong | S2: Backtracking (9) + Rate Limiter + Redis TTL/token-bucket |
| 6–7 | Pass — patchy | S2: Backtracking + retry weakest Heap |
| < 6 | Fail | Repeat Heap in S2, Backtracking → S3 |
Hours Log
| Day | Planned | Actual | What blocked? |
|---|---|---|---|
| Mon | 2h | ||
| Tue | 2.5h | ||
| Wed | 2h | ||
| Thu | 2.5h | ||
| Fri | 2.5h | ||
| Sat | 4h | ||
| Sun | 1.5h | ||
| Total | 17h |
Week Retro (closed 2026-07-02, retro'd late — Thu)
Scorecard
- Problems solved on time: 8/10 (2 fail: 621, 355)
- Total solve time: ~156 min across all 10 (passes only: ~76 min); target total ~285 min
- Both hards crushed solo: 212 (24:00/45), 295 (9:00/40)
- Weakest: k-way lazy merge (355 — needed hints, SAME gap as LC 23 in W2) + Task Scheduler O(N) formula (621 — used simulation, blew time)
- Strongest: heap core — 703 (3:00), 215 (5:00), 973 (9:00), 295 (9:00 hard)
| LC | Time | Target | |
|---|---|---|---|
| 208 | 6:00 | 25 | ✓ |
| 211 | 13:00 | 30 | ✓ |
| 212 H | 24:00 | 45 | ✓ |
| 703 | 3:00 | 15 | ✓ |
| 1046 | 7:30 | 15 | ✓ |
| 973 | 9:00 | 25 | ✓ |
| 215 | 5:00 | 25 | ✓ |
| 621 | 43:30 | 30 | ✗ formula |
| 355 | 36:00 | 35 | ✗* merge+hints |
| 295 H | 9:00 | 40 | ✓ |
SD / Redis / DDIA
- URL Shortener whiteboard: ⬜ deferred (did Rate Limiter in S2 instead)
- Redis: ✅ started — notes formatted + build-your-own topic checklist
- DDIA Ch6 Replication: ⬜ not logged
What slipped
- URL Shortener (SD) — swapped for Rate Limiter.
- 2 DSA misses are pattern-recall, not solving: merge (355) + formula (621).
- Zero cold whiteboard reps — SD is study-notes only so far.
Gate decision (8–10 = PASS STRONG)
PASS STRONG → S2 Backtracking (confirmed; already in progress).
One thing to fix in S2
Close the k-way merge gap for good: drill LC 23 → 355 back-to-back, no hints (scheduled). It's failed twice — no third.