/Practice

Reels: short lessons on AI and engineering

Interview room1 / 266
1 / 9

Question

We’re building an app for 200,000 field technicians who inspect pipelines. They work underground for hours with no signal, capture 30 to 60 photos and short videos per job, and fill long forms. Supervisors must see results within minutes of a technician getting signal. Design the mobile and backend architecture.

2 / 9

In plain words

An app that pipeline technicians carry to inspection sites. They open a job, walk the site, answer a long checklist, take photos and short videos as evidence, and submit. Supervisors in the office watch jobs arrive on a web dashboard and send back corrections. Think of a courier’s paper notebook. At every stop he writes everything down, and the office copies the notebook whenever he passes a phone booth. The notebook is the truth; the phone booth is a bonus.

3 / 9

Ask before you design

“How long can a device stay offline?” Up to two weeks at remote sites. “Is a job edited by more than one person?” A technician owns the inspection; supervisors can change job details and instructions. “Which platforms, and what does the team know?” Android and iOS. The team is strong in React Native and Kotlin. “How big is the media?” Photos 3 to 5 MB, videos up to 500 MB.

4 / 9

Size it

Active technicians per day: 120k (60% of 200k). Jobs per day: 240k (2 jobs each). Media ingress: ≈ 48 TB/day (50 files × 4 MB × 240k jobs). Sync requests: ≈ 42 req/s avg, ~400 peak (120k × 30 syncs ÷ 86,400, ×10 for peaks). Change log growth: ≈ 25 GB/day (240k jobs × ~100 changes × 1 KB).

5 / 9

Design in words

The phone holds the truth for the technician’s work. Records sync through a small API; media goes straight to object storage; supervisors read the same change stream the phones write into. SQLite on device. The source of truth for screens. Jobs, form answers, an outbox of pending operations and a table of upload parts. Encrypted with SQLCipher because the phone can be lost. Sync engine. Native code (Kotlin and Swift, or one KMP module) so it runs without the JS runtime. Pushes the outbox with op_ids, then pulls changes after its cursor.

6 / 9

Decision they will probe

UI framework: React Native, native sync core over Fully native apps. Team skills and speed; the parts that must run in background are native anyway. Conflict policy: Field-level merge over Last-write-wins. Supervisor and technician edit the same job; whole-record overwrite would lose work.

7 / 9

A follow-up to expect

“A technician uploads the same photo twice. What happens?” The hash matches an existing object, so /files/init returns exists: true and the app skips the upload. The record just references the same media.

8 / 9

Front end

The technician app is the hardest part of this system to get right. It must be fast with gloves on, readable in sunlight, and honest about what has and has not reached the office. The team uses React Native for screens, with native modules for everything that runs in the background. Screens: React Native (New Architecture, Fabric), FlashList, render state, collect input, never call the network. View state: Zustand stores + WatermelonDB observables, derive what each screen shows from the database. Form engine: JSON-schema checklist + react-hook-form, conditional questions, validation, per-field autosave.

9 / 9

What makes it principal-level

A principal answer also sizes the system first, separates records from bytes, chooses merge rules per field, covers evidence integrity and the long-offline edge case, and explains why the sync core is native even in a React Native app.

Offline-first inspection app with huge uploads
#mobile#interview
Interview room2 / 266
1 / 9

Question

Design the messaging feature for a service marketplace: customers and providers chat one-to-one and in small groups of up to 50. Messages must arrive in order, show sent, delivered and read states, work offline, and support photos. Expect 5 million daily users.

2 / 9

In plain words

Chat inside a services marketplace: customers and providers message each other one-to-one or in small groups, share photos, and see when messages are sent, delivered and read. Think of WhatsApp built into the booking app. Like a post office that numbers every letter in a conversation. Anyone holding letters 1 to 40 who receives letter 43 knows exactly which two to ask for.

3 / 9

Ask before you design

“Group size limits?” 1:1 and groups up to 50. No broadcast channels. “End-to-end encryption?” Not in v1; encrypted in transit and at rest. “Multiple devices per user?” Yes, phone and tablet; history must match on both. “How long is history kept?” Forever for 1:1, two years for groups.

4 / 9

Size it

Daily users: 5M. Messages per day: ≈ 100M (20 each). Average write rate: ≈ 1,150 msg/s (100M ÷ 86,400). Peak write rate: ≈ 10k msg/s (×8–10 at evening peaks). Concurrent sockets: ≈ 1M (20% of daily users online at peak). Storage: ≈ 50 GB/day text (100M × ~500 bytes with metadata).

5 / 9

Design in words

Clients hold a persistent socket to a gateway layer. A chat service orders and stores messages per conversation, and a fan-out step delivers to online devices or falls back to push. WebSocket gateways. Thin, stateful only for connections. A registry in Redis maps user and device to the gateway holding its socket, so any service can route a delivery. Chat service. Assigns each message a per-conversation sequence number, dedupes on the client message ID, and appends to the store. This step decides the order.

6 / 9

Decision they will probe

Transport: WebSocket over Long polling or MQTT. Bidirectional, widely supported, and gateways scale horizontally with a connection registry. Fan-out: On write over On read. Groups cap at 50, so writing to each recipient’s inbox is cheap and makes unread counts trivial.

7 / 9

A follow-up to expect

“How do you show ‘typing…’?” Ephemeral events over the socket only, never stored, throttled to one every few seconds.

8 / 9

Front end

The chat client is a small real-time system of its own: a connection manager, a local message store, an outbox for sends and a UI that never jumps or flickers as messages change state. UI: Jetpack Compose / SwiftUI, lists, composer, receipts. ViewModels: StateFlow / @Observable, map database queries to UI state. Connection manager: OkHttp WebSocket / URLSessionWebSocketTask, connect, heartbeat, reconnect with jitter, route events.

9 / 9

What makes it principal-level

A principal answer sizes sockets and write rate, makes sends idempotent, orders by server sequence, treats socket delivery as an optimisation over cursor sync, and explains how the design changes for large channels and encryption.

Real-time chat with offline delivery
#mobile#interview
Interview room3 / 266
1 / 9

Question

Design the home feed for a social shopping app: an endless scroll of posts with photos and short videos. It must open instantly, scroll at 60 fps on mid-range Android phones, and feel fresh. 20 million daily users.

2 / 9

In plain words

The home screen of a social shopping app: an endless scroll of posts from brands and people you follow plus recommendations, with photos and short videos. It is the first thing users see and the place they spend most time. Like a newspaper vendor who keeps yesterday’s paper on the counter so you can start reading immediately, while today’s edition is being fetched from the van.

3 / 9

Ask before you design

“Ranked or chronological?” Ranked, from people and brands the user follows plus recommendations. “What share of posts are video?” About 30%, mostly under 30 seconds. “Minimum device?” Android with 3 GB RAM, iPhone 11 and newer. “Do accounts with millions of followers exist?” Yes, a few thousand brands.

4 / 9

Size it

Feed opens per day: ≈ 100M (20M users × 5 sessions). Feed page requests: ≈ 3,500/s avg (100M × 3 pages ÷ 86,400). Image egress: ≈ 2 PB/month (mostly CDN cache hits). Cold start budget: < 1.5 s to first post (cached page shown first).

5 / 9

Design in words

The app renders a cached page instantly, then refreshes from a feed service that merges precomputed timelines with recommendations. Media comes from a CDN in sizes chosen for the device. Local cache. The app stores the last few pages of posts, so it opens on yesterday’s feed in under a second while the fresh page loads. Image loader. Requests the exact width the screen needs from the CDN, decodes off the main thread, and keeps memory and disk caches with size limits.

6 / 9

Decision they will probe

Timeline build: Hybrid fan-out over Pure push or pure pull. Balances cheap reads with bounded write amplification from huge accounts. Image sizing: Fixed width buckets over Exact pixel sizes. A handful of sizes keeps CDN hit rates high.

7 / 9

A follow-up to expect

“How do you measure ‘opens instantly’?” Time to first post rendered, from process start, as p50 and p90 by device class, in production telemetry.

8 / 9

Front end

For a feed, front-end engineering is the product. The client owns perceived speed, scroll smoothness, media memory and data use, and it produces the event stream that ranking depends on. UI: Compose LazyColumn / SwiftUI List or UICollectionView / FlashList, render items with stable keys and content types. Paging: Paging 3 RemoteMediator / custom cursor pager, load from DB, fetch next page, write to DB. Images: Coil / Nuke or Kingfisher / expo-image, sized requests, memory + disk cache, downsampling.

9 / 9

What makes it principal-level

A principal answer sets performance budgets, explains hybrid fan-out with numbers, designs media for the device and network, and keeps the feed working when ranking fails.

Infinite feed with images and video
#mobile#interview
Checkout and payments that never double-charge
Healthcare appointment booking without double-booking
Mobile platform for 150 engineers: builds, releases, flags
An AI assistant inside a mobile app
On-device AI versus cloud: a hybrid design
Retrieval-augmented answers over company documents
Serving an open LLM on your own GPU fleet
Shipping LLM features safely: evals, guardrails, monitoring
vLLM High-Throughput Engine Architecture
Block-Allocated PagedAttention Triton Kernel
Continuous Batching & Iteration-Level Scheduling
Tensor Parallelism & Ring-AllReduce Communication
Speculative Decoding Target-Draft Pair Verifier
vLLM Automatic Prefix Caching Architecture
Fused Flash-Softmax Triton Kernel
Hierarchical Navigable Small World (HNSW) Graphs
Reciprocal Rank Fusion (RRF) Hybrid Search
Parent-Child Hierarchical Context Retrieval
Entity-Relation Graph Mining & GraphRAG Pipeline
Redis Vector Semantic Response Caching
Inverted Indexing & BM25 Scoring Engine
BGE-Reranker Multi-Stage Retrieval Pipeline
Selective Context Window Token Compression
Low-Rank Adaptation (LoRA) Weight Decomposition
PyTorch LoRA Linear Layer Implementation
QLoRA NormalFloat4 & Double Quantization
Direct Preference Optimization (DPO) Loss Function
DeepSpeed ZeRO-3 Memory Partitioning
PyTorch Fully Sharded Data Parallel (FSDP)
Merging LoRA Adapters into Base Model Weights
Unsloth Gradient Calculation Acceleration
LLM-as-a-Judge Evaluation & Calibration Architecture
Llama-Guard Jailbreak & Safety Classifier
Faithfulness, Answer Relevance & Context Recall Metrics
Guardrails AI Structured Pydantic Output Validation
Evaluating Multimodal LLMs on Visual Reasoning
Automated Adversarial Red-Teaming Suites
SLURM GPU Cluster Job Scheduling & Failure Recovery
Async Zero-Redundancy Optimizer Checkpointing
Triton Compiler JIT Codegen Pipeline
NCCL Inter-Node Transport Protocols & Infiniband
Ray Serve Distributed Actor Deployment
Prompt Patterns: Chain of Thought, Few-Shot, Structured Output
CLIP and ViT Multimodal Embeddings
App Startup: Cold Start From Tap to First Frame
Mobile Observability: Crashes, ANRs, Traces and Rollout Gates
Mobile Security: Tokens, Keystore, Pinning and Tampering
Live Location Tracking for a Driver App
Push Notification Platform at Scale
Feature Flag and Experimentation SDK
React Native New Architecture: JSI, Fabric, TurboModules and Threads
React Native State: Server Cache, Client Store and Render Storms
Modular React Native for Many Apps: The Modularity Ladder
Memory Leaks in React Native: Three Heaps, One Staircase
Offline Sync in React Native: What to Persist and Where
The 95/5 Rule and Performance Budgets in CI
Describe a situation where you encountered a problem at work or in …
How do you approach solving everyday challenges in your role?
Share an example of a time when you identified a problem before it …
How do you handle situations where you don't have enough informatio…
Describe a time when you collaborated with others to solve a proble…
How do you prioritise multiple problems that demand your attention …
Describe a situation where you had to deal with a difficult team me…
How do you handle situations when you encounter resistance to your …
Share an example of a time when you had to think outside the box to…
How do you ensure that solutions you implement are sustainable and …
Describe a time when you used data analysis to solve a complex prob…
Share an example of a time when you had to make a critical decision…
How do you encourage a culture of continuous improvement within a t…
Describe a situation where you had to lead a team through a particu…
How do you approach solving problems that require cross-functional …
Share an example of a time when you had to deal with a high-stress …
How do you handle situations where you must navigate competing prio…
Describe a time when you proactively identified potential problems …
How do you foster a culture of problem-solving and innovation withi…
Share an example of a time when you had to develop a comprehensive …
How do you encourage team members to take ownership of the problems…
Share an example of a time when you had to navigate through conflic…
How do you stay updated on the latest problem-solving techniques an…
Describe a time when you had to lead a team through a crisis, demon…
How do you handle situations where you must make decisions without …
Tell me about a bug you could not reproduce. How did you solve it?
Describe a time you simplified an over-engineered system.
Tell me about a technical decision you got wrong.
How do you track down a performance regression in a mobile app?
Describe a time you had to balance shipping fast with quality.
Tell me about a time an AI feature behaved unexpectedly in production.
Describe a production incident caused by your own change.
Tell me about a time you significantly reduced cost.
Two pointers: spot it, crack it
3Sum · quick solution
Two pointers template
Container With Most Water · quick solution
Trapping Rain Water · quick solution
Sliding window: spot it, crack it
Minimum Window Substring · quick solution
Sliding window template
Longest Repeating Character Replacement · quick solution
Sliding Window Maximum · quick solution
Fast and slow pointers: spot it, crack it
Linked List Cycle II · quick solution
Fast and slow pointers template
Happy Number · quick solution
Find the Duplicate Number · quick solution
Binary search: spot it, crack it
Koko Eating Bananas · quick solution
Binary search template
Search in Rotated Sorted Array · quick solution
Capacity To Ship Packages Within D Days · quick solution
Prefix sums and hashing: spot it, crack it
Longest Consecutive Sequence · quick solution
Prefix sums and hashing template
Group Anagrams · quick solution
Product of Array Except Self · quick solution
Monotonic stack: spot it, crack it
Daily Temperatures · quick solution
Monotonic stack template
Largest Rectangle in Histogram · quick solution
Remove K Digits · quick solution
Heap / top-K: spot it, crack it
Merge K Sorted Lists · quick solution
Heap / top-K template
Top K Frequent Elements · quick solution
Find Median from Data Stream · quick solution
Intervals: spot it, crack it
Meeting Rooms II · quick solution
Intervals template
Insert Interval · quick solution
Non-overlapping Intervals · quick solution
BFS and DFS: spot it, crack it
Number of Islands · quick solution
BFS and DFS template
Rotting Oranges · quick solution
Word Ladder · quick solution
Topological sort: spot it, crack it
Course Schedule · quick solution
Topological sort template
Course Schedule II · quick solution
Alien Dictionary · quick solution
Union-find: spot it, crack it
Redundant Connection · quick solution
Union-find template
Number of Provinces · quick solution
Accounts Merge · quick solution
Backtracking: spot it, crack it
Combination Sum · quick solution
Backtracking template
Permutations · quick solution
N-Queens · quick solution
Dynamic programming: spot it, crack it
Coin Change · quick solution
Dynamic programming template
Longest Increasing Subsequence · quick solution
Edit Distance · quick solution
Trie: spot it, crack it
Search Suggestions System · quick solution
Trie template
Implement Trie · quick solution
Word Search II · quick solution
Greedy: spot it, crack it
Gas Station · quick solution
Greedy template
Jump Game II · quick solution
Partition Labels · quick solution
LRU cache with a memory budget
LRU cache with a memory budget · the code
Image loader with coalescing and two cache tiers
Image loader with coalescing and two cache tiers · the code
Offline outbox with idempotent sync
Offline outbox with idempotent sync · the code
Retry with exponential backoff and jitter
Retry with exponential backoff and jitter · the code
Search-as-you-type with debounce and cancellation
Search-as-you-type with debounce and cancellation · the code
Cursor-based infinite feed
Cursor-based infinite feed · the code
Resumable multipart uploader
Resumable multipart uploader · the code
Client-side token bucket rate limiter
Client-side token bucket rate limiter · the code
List diffing for animated UI updates
List diffing for animated UI updates · the code
How an LLM works inside
Making inference fast and cheap
Embeddings and vector search
Prompting, RAG or fine-tuning?
Tool use, agents and MCP
Integrating LLMs into products
Using AI to accelerate engineering teams
Front-end architecture for offline, real-time and AI apps
The sync engine
The transfer manager
The background-work layer
The server sync service
What the OS actually does to your app
Offline-first, explained properly
Five principles behind every sync system
The outbox pattern
Idempotency: making retries safe
Cursors and server sequence numbers
Deletes and devices that vanish for weeks
Choosing a conflict strategy
SQLite at scale on a phone
Schema changes while users stay offline
The UI layer: one-way data flow
Uploading 4 GB on a bad network
Downloads, storage and caching
First sync with two million rows
WorkManager, properly
Long transfers on modern Android
Doze, standby buckets and OEM killers
BGTaskScheduler without surprises
Background URLSession, the big-file workhorse
iOS traps that quietly break sync
Why JS can’t own background sync
Three levels of React Native sync
Why the backend scales sideways
Surviving your own users
Capacity maths for the whiteboard
Scaling in stages, with gates
Security for offline data
Knowing your sync is healthy
Testing a system built to be killed
How principals talk about decisions
Native, React Native or a shared core?
Telling an incident story
Pre-Filtering vs Post-Filtering in Vector Stores
PyTorch CUDA Memory Allocation & OOM Diagnostics
Spotting Context Hallucinations in RAG
Real-Time Factuality Verification Shields
The six-step method
Read the constraints first
Signal → pattern
Signal → pattern, part 2
TypeScript power tools
Bugs that cost offers
Quick check: constraints
Quick check: signals
Quick check: BFS
The STAR shape
What panels listen for
The one rule
Quick check
The one rule
What survives a kill
One edit, end to end
Explain it like a restaurant
The push contract
Kill it at 58%
Quick check
Android: pick the tool
iOS: pick the tool
React Native: who does what
Myth check
iOS check
Field app, real numbers
Requests per second
Scale in 4 stages
The retry storm
Your 30-second pitch
Retry check
Whiteboard in 5 strokes
The follow-up they always ask