Day 84 — Mock: DSA + System Design II

85 minutes · mock day · weak-topic DSA + URL Shortener

Tonight's goal is one strict weak-topic DSA mock, then one URL Shortener redraw: base62 write path, cached read path, spoken clearly.

Tonight's protocol

  1. 0:00-0:02: choose exactly two weak DSA problems from the menu below. Use only this menu.
  2. 0:02-0:05: answer the warm-up MCQs. When the five-minute box ends, solving starts.
  3. 0:05: start one strict 60-minute DSA timer using the mock-day protocol: timer first, talk first, code second.
  4. 0:05-0:35: solve Problem 1. First two minutes: say the pattern name, brute force, better approach, time, and space aloud. If stuck at minute 25, read only the pattern name and use the final five minutes.
  5. 0:35-1:05: solve Problem 2 with the same spoken checkpoint and stuck rule. Stop when the DSA timer ends.
  6. 1:05-1:08: from memory, redraw the URL Shortener boxes: client, load balancer, write API, ID service, redirect API, cache, database, analytics queue.
  7. 1:08-1:15: explain the design aloud: POST /links issues an ID, base62-encodes it, saves the mapping, and returns the short code; GET /code checks cache first, falls back to the database, fills cache, then redirects.
  8. 1:15-1:20: open the compare diagram below, mark what your redraw missed, and write one root-cause line.
  9. 1:20-1:25: score the self-check gate. Failed DSA problems go to the next revision list.

The problem menu

Pick exactly two. For each chosen problem, explain aloud before typing, then attempt without solution text.

ProblemPattern nameSlot
Product of Array Except Self Prefix × suffix products 30 min
Longest Repeating Character Replacement Sliding Window II: validity with a budget 30 min
Daily Temperatures Monotonic stack: whatever you pop found its answer 30 min
Reorder List Composing linked-list primitives 30 min
Diameter of Binary Tree Piggyback on Height: tree DFS return values 30 min
Number of Islands Grid DFS: flood components 30 min
Coin Change DP III: unbounded minimum DP 30 min
Edit Distance DP VII: two strings, three operations 30 min
Compare only after your URL Shortener redraw URL Shortener practice diagram The write path issues an ID and writes the mapping. The read path checks cache before database and redirects on a hit. Client GET /aB7x9Q Edge / LB route reads Redirect API cache first return 302 Hot cache code to URL Links DB source of truth Write API POST /links ID service base62 code Analytics queue Key insight: cache hit avoids DB on redirect.

Warm-up MCQs

1. What must happen before code in the DSA mock?

2. What makes a weak problem count as revised?

3. Redirect traffic dwarfs create traffic. What should be protected first?

4. Which write path matches URL Shortener?

5. Spot the redirect-path bug: the database is checked before cache.

6. What path gets most URL Shortener design attention?

Self-check gate

Pass bar

Pass tonight if you scored at least 1.5 out of 2 on DSA, explained approach plus complexity before both attempts, and your URL Shortener redraw included ID service, base62 code, mapping database, cache-before-database read path, and async analytics.

Score each DSA problem: 1 for accepted inside its slot, 0.5 for the right invariant with unfinished code, 0 for the wrong direction. If you score below 1.5, add each failed problem to the next revision list with WA: <missed invariant or implementation bug>.

If the system-design redraw misses base62 writes or cached reads, add URL Shortener: redraw write/read paths to the next session's first five minutes.