Advanced Number Theory Interview Patterns: Chinese Remainder Theorem, Euler Totient, and Digit DP (2025)
Chinese Remainder Theorem (CRT) CRT solves systems of congruences: given x ≡ ai (mod mi) where mi are pairwise coprime, […]
Chinese Remainder Theorem (CRT) CRT solves systems of congruences: given x ≡ ai (mod mi) where mi are pairwise coprime, […]
Requirements and Scale Functional: turn-by-turn navigation, ETA estimation, real-time traffic updates, points of interest search, route alternatives. Non-functional: 1B daily
Core Entities and Fan-Out Strategies Post: post_id, author_id, content, media_urls (array), created_at, like_count, comment_count, share_count. Follow: follower_id, followee_id, created_at. FeedItem:
Core Entities Driver: driver_id, name, vehicle_type (ECONOMY/COMFORT/XL), status (OFFLINE, AVAILABLE, ON_TRIP), current_location (POINT: lat/lng), last_location_update, rating, acceptance_rate. Rider: rider_id, name,
Requirements and Core Challenge Functional: multiple users edit the same document simultaneously, changes from all users are reflected in real
Core Challenge and Entities A flash sale creates a sudden traffic spike (100x-1000x normal load) competing for limited inventory. The
Backtracking Template Backtracking = DFS + undo. The universal template: choose (add to path), recurse (explore), unchoose (remove from path).
Problem Statement Design a content moderation system for a social platform. User-generated content (text, images, video) must be screened before
Scope and Requirements A payment processing platform handles money movement between buyers and sellers through external payment processors (Stripe, Adyen,
Why Sorting Algorithms Still Matter in Interviews Interviewers at top tech companies still ask about sorting not to test memorization,
Core Entities Provider: provider_id, name, email, type (DOCTOR, THERAPIST, CONSULTANT, TUTOR), timezone, settings (JSONB: buffer_minutes_between_appointments, max_advance_days, min_notice_hours, auto_confirm). Schedule: schedule_id,
2D Grid BFS and DFS Fundamentals from collections import deque DIRS = [(0,1),(0,-1),(1,0),(-1,0)] # right, left, down, up def bfs_grid(grid,
Cycle Detection in Undirected Graphs from collections import deque # DFS approach: track parent to distinguish back edge from tree
Core Entities Product: product_id, sku, name, category_id, unit_cost, unit_weight_grams, dimensions (JSONB: length, width, height in mm), reorder_point, reorder_quantity, lead_time_days, is_active.
Requirements and Scale Functional: upload raw video, transcode to multiple resolutions (240p/480p/720p/1080p/4K), store and serve video streams, support adaptive bitrate