Pick up where you left off.
- Free lessons in every track
- Your progress saved across devices
- Pro unlocks the entire library
Trapping Rain Water
Step 5 / 14Design a URL Shortener
ArchitectureParking Lot
Class diagramHow RAG answers a question
Scene 3 / 7Canary deployments
Rolling outlmax = 2rmax = 3water = 4
1def trap(h):
2 l, r, lmax, rmax, water = 0, len(h) - 1, 0, 0, 0
3 while l < r:
4 if h[l] < h[r]:
5 lmax = max(lmax, h[l])
6 water += lmax - h[l]; l += 1
7 else:
8 rmax = max(rmax, h[r]); r -= 1
Clientbrowser
API gatewayauth · limits
URL servicestateless × N
Cachechecked first
Databaseshort → long
Click eventsqueue → analytics
ID generatorbase62 · no collisions
Read path. A redirect checks the cache first; only a miss falls through to the database, then the cache is filled for next time.
ServiceData storeQueueIn focus
ParkingLot
- levels: List<Level>
+ park(v): Ticket+ unpark(t): Fee
1..*
Level
- spots: List<Spot>
+ findSpot(v): Spot
1..*
«abstract»Spot
- occupied: bool
+ fits(v): bool
CompactSpot
LargeSpot
EVSpot
Why abstract? Each spot type decides what fits. Adding EV charging is a new subclass — ParkingLot never changes. That’s open–closed in practice.
Question
Embed
Vector search
Prompt + LLM
Answer
Vector DB
top-k = 3 nearest chunks
Scene 3The question is now a vector. It’s compared with every chunk in the store, and only the three closest come back to ground the answer.
Story
Commitmain · a3f9c1e
Buildcontainer image
Unit + integration testsall green
Deploy to stagingsmoke tests passed
Canary — 10% of trafficwatching metrics
Production — 100%waiting on gates
Traffic split
canary v2 · 10%stable v1 · 90%
Promotion gatesError rate within thresholdp99 latency unchangedSoak time remaining
If either gate fails, traffic shifts back to v1 automatically — no one gets paged at 3 a.m.
Welcome back
Log in to continue learning.
or with email
By continuing you agree to the Terms and Privacy Policy.