Skip to content

quanhua92/interview-prep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

141 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interview Prep

A comprehensive interview preparation toolkit covering coding patterns, system design, behavioral interviews, CS fundamentals, salary negotiation, resume/career prep, role-specific topics, AI-assisted interview scenarios, data analytics, low-level design, and production engineering. Track progress across 144 coding problems and 145 topics with a unified CLI dashboard. Solutions available in Python, C, C++, Rust, and JavaScript.

Features:

  • WASM sandbox — user code runs safely inside wasmtime with fuel-based CPU limits, memory caps, wall-clock timeout, and no network/filesystem access
  • Progress ring, stats cards, and per-section breakdowns
  • Code Editor — auto-loads all in-progress problem files with CodeMirror syntax highlighting
  • Save & Run — edit code in the browser, save (Ctrl+S), and run (Ctrl+R) directly from the editor header
  • Terminal — PASS/FAIL/SKIP results panel
  • Full-screen Code Page (/code) — dedicated coding layout with configurable terminal position (Right, Left, Bottom, Top), adjustable terminal width/height, and Ctrl+` to toggle terminal
  • Language selector — toggle Python / C / C++ / Rust / JavaScript in Coding Patterns card or Settings sidebar, persisted to localStorage, filters file tree and Run output
  • File tree sidebar — activity bar with collapsible file explorer
  • Version history — every save creates a version snapshot; revert to any previous version
  • Hint — toggle to view solution files directly in the editor
  • Autocomplete — language-aware hints for Python, C, C++, Rust, and JavaScript
  • Click any topic name to start it and open its files in the editor
  • Filter by status (New / In Progress / Done) and instant search

Full-screen code editor (/code) with VS Code-style layout, configurable terminal, and Ctrl+` to toggle:

Code Editor

Progress dashboard with inline code editor:

Dashboard

See full dashboard screenshot

Quick Start

git clone https://github.com/quanhua92/interview-prep.git
cd interview-prep
docker compose up -d

Go to http://localhost:8888 to view the dashboard, or http://localhost:8888/code for the full-screen code editor.

Note: docker-compose.yml pulls a pre-built image from Docker Hub by default. To build locally instead, uncomment the build: . line and comment out the image: line.

For a minimal setup (no file persistence):

docker run -d -p 8888:8888 quanhua92/interview-prep

CLI

# Install dependencies
uv sync

# Install git hooks (blocks accidental commits of problem solve() methods)
git config core.hooksPath .githooks

# View progress dashboard
uv run python main.py status

# Run a problem file directly
uv run python tier1_foundation/sliding_window/problems/p003_longest_substring.py

# Mark topic progress
uv run python main.py update sliding_window in_progress
uv run python main.py update url_shortener completed

# Record a practice attempt
uv run python main.py attempt sliding_window

# Run problem stubs (default — expects SKIP for unimplemented problems)
uv run python run.py                   # WIP pattern problem stubs (Python)
uv run python run.py two_pointers      # Run a specific pattern's problems
uv run python run.py --all             # All pattern problem stubs

# Run solution files (answer keys)
uv run python run.py --solution         # WIP pattern solutions (Python)
uv run python run.py --solution --lang c   # All pattern solutions, C versions
uv run python run.py --solution --lang cpp  # All pattern solutions, C++ versions
uv run python run.py --solution --lang rs   # All pattern solutions, Rust versions
uv run python run.py --solution --lang js   # All pattern solutions, JavaScript versions

# Generate static HTML progress report
uv run python main.py report

# Launch interactive web dashboard (0.0.0.0:8888)
uv run python main.py start

WASM Sandbox

User code runs inside wasmtime (WebAssembly runtime) for safe sandboxed execution — fuel-based CPU limit, hard memory cap, wall-clock timeout, no network, no filesystem access unless explicitly mapped. Set WASM_SANDBOX=0 to force native execution (no sandbox).

Language Toolchain Compile .wasm size
C wasi-sdk (clang wasm32-wasip1) ~60ms ~100KB
C++ wasi-sdk (clang++ -fno-exceptions) ~340ms ~200KB
Rust rustc wasm32-wasip1 + rstest rlib ~70ms ~1.9MB
JavaScript QuickJS-NG WASI (single .wasm) ~100ms ~3KB
Python CPython 3.14.5 WASI (pre-compiled .cwasm) ~60ms 27MB

Security: Fuel-based CPU limit, hard memory cap, wall-clock timeout, no network, no filesystem access unless explicitly mapped. See docs/WASM_SANDBOX.md for full details.

Project Structure

interview-prep/
├── main.py                        # CLI entry point
├── tracker.py                     # Data layer (CRUD on tracker.json)
├── web.py                         # FastAPI server + HTML dashboard
├── index.html                     # HTML template (Tailwind CSS)
├── static/app.js                  # Dashboard-specific JS (filters, status updates)
├── static/app.css                 # Shared editor and sidebar styles
├── static/editor-core.js          # Shared editor logic (CodeMirror, file tree, save/run/hint)
├── static/code.js                 # /code page logic (layout, terminal toggle)
├── static/code.html               # /code page (full-screen coding layout)
├── static/code.css                # /code page layout presets
├── static/codemirror/             # Vendored CodeMirror (syntax highlighting)
├── static/tailwind-browser.js    # Vendored Tailwind CSS runtime
├── Dockerfile                     # Docker image (Python 3.14-slim)
├── docker-compose.yml             # Docker Compose with volume mounts for progress + tier dirs
├── tier{1-4}_*/                   # 29 coding patterns
│   └── <pattern>/
│       ├── template.py
│       ├── problems/              # Practice stubs
│       ├── solutions/             # Answer keys
│       ├── test_runners/           # JudgeBase subclasses (test cases + I/O contract)
│       └── README.md
├── system_design/                 # 25 system design topics
│   └── <topic>/
│       ├── discussion.md
│       └── checklist.md
├── behavioral/                    # 12 behavioral themes
│   └── <theme>/
│       ├── discussion.md
│       └── checklist.md
├── salary_negotiation/            # 8 salary negotiation topics
│   └── <topic>/
│       ├── discussion.md
│       └── checklist.md
├── cs_fundamentals/               # 22 CS fundamentals topics
│   └── <topic>/
│       ├── discussion.md
│       └── checklist.md
├── resume_career/                 # 6 resume & career topics
│   └── <topic>/
│       ├── discussion.md
│       └── checklist.md
├── role_specific/                 # 6 role-specific topics
│   └── <topic>/
│       ├── discussion.md
│       └── checklist.md
├── ai_assisted/                   # 6 AI-assisted interview scenarios
│   └── <scenario>/
│       ├── README.md              # Interview prompt + follow-ups
│       └── TIPS.md                # Concepts, mistakes, AI strategy
├── data_analytics/                # 9 data analytics topics
│   └── <topic>/
│       ├── discussion.md
│       └── checklist.md
├── low_level_design/              # 12 low-level design topics
│   └── <topic>/
│       ├── discussion.md
│       └── checklist.md
├── production_engineering/        # 10 production engineering topics
│   └── <topic>/
│       ├── discussion.md
│       └── checklist.md
├── tests/                         # pytest suite
├── src/utils/                     # Shared utilities (Problem, TestCase, ListNode, TreeNode)
├── src/runners/                   # Cross-language test runners (C, C++, Rust, JavaScript)
├── src/wasm_libs/                 # Per-language IO libraries (linked into WASM or native)
└── progress/tracker.json          # Progress data (gitignored)

Coding Patterns (29 patterns, 4 tiers)

Tier 1: Foundation (Must Master)

Pattern Key Problems
Sliding Window P003 Longest Substring, P438 Find All Anagrams, P424 Longest Repeating Char, P567 Permutation in String, P395 Longest Substring K Repeating
Two Pointers P167 Two Sum II, P011 Container With Most Water, P015 3Sum, P392 Is Subsequence, P524 Longest Word through Deleting, P532 K-diff Pairs
Fast & Slow Pointers P141 Linked List Cycle, P202 Happy Number, P876 Middle of Linked List
Merge Intervals P056 Merge Intervals, P253 Meeting Rooms II, P057 Insert Interval, P495 Teemo Attacking
BFS P102 Binary Tree Level Order, P994 Rotting Oranges, P1091 Shortest Path Binary Matrix, P513 Find Bottom Left Tree Value, P515 Find Largest Value in Each Tree Row
HashMap / HashSet P380 Insert Delete GetRandom, P398 Random Pick Index, P447 Number of Boomerangs, P500 Keyboard Row, P535 TinyURL, P575 Distribute Candies, P382 Linked List Random Node, P391 Perfect Rectangle
String Manipulation P520 Detect Capital, P521 Longest Uncommon Subsequence I, P434 Number of Segments, P482 License Key Formatting

Tier 2: Intermediate (Very Common)

Pattern Key Problems
DFS P200 Number of Islands, P695 Max Area of Island, P1306 Jump Game III, P572 Subtree of Another Tree, P538 Convert BST to Greater Tree, P508 Most Frequent Subtree Sum, P450 Delete Node in a BST
Two Heaps P295 Median Finder, P355 Design Twitter, P480 Sliding Window Median
Top K Elements P215 Kth Largest Element, P347 Top K Frequent Elements, P973 K Closest Points, P407 Trapping Rain Water II
Binary Search P704 Binary Search, P153 Find Minimum in Rotated Sorted Array, P278 First Bad Version, P354 Russian Doll Envelopes
Dynamic Programming P070 Climbing Stairs, P322 Coin Change, P198 House Robber, P516 Longest Palindromic Subsequence, P518 Coin Change II, P514 Freedom Trail, P552 Student Attendance Record II, P576 Out of Boundary Paths
Prefix Sum P560 Subarray Sum Equals K, P238 Product Except Self, P713 Subarray Product Less Than K, P523 Continuous Subarray Sum, P525 Contiguous Array
Stack P020 Valid Parentheses, P394 Decode String, P155 Min Stack
Divide & Conquer P023 Merge k Sorted Lists, P912 Sort an Array, P169 Majority Element, P427 Construct Quad Tree, P493 Reverse Pairs
Bit Manipulation P191 Number of 1 Bits, P136 Single Number, P338 Counting Bits, P476 Number Complement
Randomized P519 Random Flip Matrix, P470 Implement Rand10 Using Rand7
Math / Constructive P458 Poor Pigs, P479 Largest Palindrome Product, P478 Generate Random Point in a Circle, P556 Next Greater Element III, P564 Find the Closest Palindrome
Design P460 LFU Cache

Tier 3: Advanced (Important for Top Companies)

Pattern Key Problems
Backtracking P078 Subsets, P039 Combination Sum, P017 Letter Combinations, P473 Matchsticks to Square, P491 Non-decreasing Subsequences, P488 Zuma Game
Modified Binary Search P033 Search in Rotated Sorted Array, P875 Koko Eating Bananas, P410 Split Array Sum
Cyclic Sort P442 Find All Duplicates, P268 Missing Number, P448 Find Disappeared
Subsets P046 Permutations, P090 Subsets II, P077 Combinations
Trie P208 Implement Trie, P212 Word Search II, P211 Design Add and Search Words, P472 Concatenated Words

Tier 4: Expert (Differentiators)

Pattern Key Problems
Union Find P323 Connected Components, P684 Redundant Connection, P990 Satisfiability Equations
Monotonic Stack P739 Daily Temperatures, P084 Largest Rectangle in Histogram, P853 Car Fleet, P907 Sum of Subarray Minimums, P456 132 Pattern, P503 Next Greater Element II
Greedy P055 Jump Game, P455 Assign Cookies, P134 Gas Station, P135 Candy, P452 Min Arrows to Burst Balloons, P502 IPO, P621 Task Scheduler
Matrix Traversal P054 Spiral Matrix, P048 Rotate Image, P498 Diagonal Traverse, P542 01 Matrix
Graph P207 Course Schedule, P210 Course Schedule II, P997 Find the Town Judge

Each pattern contains:

  • template.py — Annotated skeleton with variants
  • problems/ — Practice stubs with test cases (implement solve())
  • solutions/ — Answer keys (.py + .c / .cpp / .rs / .mjs counterparts)
  • README.md — Pattern explanation, when to recognize it, complexity table

System Design (25 topics)

Topic Core Concepts
URL Shortener ID generation, caching, base62, sharding
Chat System WebSockets, message queues, presence
Rate Limiter Token bucket, sliding window, Redis
News Feed Fan-out on write/read, graph, ranking
Notification Service Push/pull, reliability, dedup, priority
Search Autocomplete Trie, ranking, prefix search at scale
Distributed Cache Consistent hashing, replication, eviction
Key-Value Store SSTables, LSM trees, Bloom filters
Web Crawler URL frontier, politeness, dedup, BFS
Ticket Booking Concurrency, locks, idempotency, oversell
Abuse Detection Velocity features, device fingerprinting, graph analysis, tiered mitigation
Ad Click Prediction CTR prediction, multi-stage ranking, calibration, embedding tables
Coding Platform Sandbox isolation, code execution, test cases, contest leaderboard
Customer LTV Probabilistic CLV, survival analysis, uplift modeling, churn prediction
Demand Forecasting Spatial-temporal ML, H3 zones, multi-quantile forecasting, online adaptation
Fraud Detection Rules cascade, GBDT scoring, graph deep learning, sub-100ms latency
Gaming Leaderboard Redis sorted sets, sharding, anti-cheat, tournament sliding windows
Hotel Booking Date-range inventory, overbooking buffers, Redis holds, fan-out writes
News Aggregator Vote-based ranking, nested comments, community feeds, hot algorithm
Online Auction Bid serialization, proxy bidding, anti-sniping, WebSocket broadcast
Pastebin Short URL, base62 ID, TTL expiration, CDN, object storage
RAG System Hybrid retrieval, vector search, cross-encoder rerank, hallucination mitigation
Recommender System Multi-stage pipeline, candidate retrieval, ranking, cold start
Search Ranking BM25 + dense retrieval, learning-to-rank, cross-encoder, query understanding
Video Conferencing SFU routing, WebRTC, simulcast, adaptive bitrate, TURN relay

Each topic contains:

  • discussion.md — Concise reference (key concepts, trade-offs, vocabulary)
  • checklist.md — Step-by-step working checklist with 5 phases + practice notes

Behavioral (12 themes, STAR method)

Theme Competency
Amazon Leadership Principles Leadership judgment, accountability
Meta Behavioral Scope amplification, cross-functional influence
Teamwork Conflict Collaboration, empathy
Handling Failure Self-awareness, resilience
Leadership Without Authority Influence, ownership
Difficult Decision Judgment, trade-off analysis
Adapting to Change Flexibility, prioritization
Working Under Pressure Time management, composure
Receiving Feedback Humility, growth
Mentoring a Teammate Teaching, patience
Owning a Mistake Accountability, transparency
Competing Priorities Prioritization, stakeholder management

Each theme contains:

  • discussion.md — STAR framework guidance, what interviewers look for, story mining prompts
  • checklist.md — Story workshop with drafting checkboxes, refinement checks, practice log

Salary Negotiation (8 topics)

Topic Focus
Market Research Compensation data, leveling, market positioning
Total Comp Breakdown Base, bonus, equity, benefits, hidden value
Initial Offer Evaluation Reading offer letters, negotiation levers
Negotiation Tactics Anchoring, framing, timing, communication
Equity & RSU Evaluation Stock options, vesting, dilution, tax
Difficult Scenarios Lowball offers, exploding offers, competing offers
Counteroffer & Staying Counteroffer risks, resigning professionally
Remote Negotiation Remote/hybrid comp adjustments, cost of living, location arbitrage

Each topic contains:

  • discussion.md — Benchmarks, frameworks, scripts, talking points
  • checklist.md — Preparation steps, script practice, scenario walkthroughs

CS Fundamentals (22 topics)

Topic Focus
Operating Systems Processes, threads, memory, file systems
Computer Networking TCP/IP, HTTP, DNS, TLS, network models
Databases SQL, indexing, transactions, ACID, normalization
Concurrency Threads, locks, race conditions, deadlocks
Distributed Systems CAP, consensus, replication, fault tolerance
Data Structures & Algos Arrays, trees, graphs, hash tables, complexity
System Security OWASP, auth, encryption, secure design
API Gateway Routing, rate limiting, auth, TLS termination
Architectural Patterns Recurring distributed system patterns
Auth Systems JWTs, OAuth2, RBAC/ABAC/ReBAC
Back-of-Envelope DAU, QPS, storage, capacity estimation
Bloom Filters Probabilistic set membership, false positives
Caching Strategies Cache write strategies, eviction, Redis
CDN Edge caching, DNS routing, origin shielding
Consistency Models Strong vs eventual, replication, quorum
Geohashing Spatial indexing, proximity queries, coordinates
Idempotency Patterns Safe retries, idempotency keys, fencing tokens
Load Balancer L4/L7 routing, health checks, failover
Multi-Region Replication, failover, conflict resolution
Realtime Protocols WebSocket, SSE, long polling, WebTransport
System Design Framework CIRCLE method, requirements, trade-offs
Zero-Downtime Blue-green, canary, rolling, feature flags

Each topic contains:

  • discussion.md — Key concepts, definitions, common questions, reference tables
  • checklist.md — Concept self-assessment, explain-out-loud prompts, practice log

Resume & Career (6 topics)

Topic Focus
Resume Structure One-page format, sections, bullet writing
Elevator Pitch 30-60 second self-introduction
Career Narrative Connecting experience into a coherent story
Explaining Gaps Employment gaps, career changes, layoffs
Portfolio Showcase Presenting projects, GitHub, writing samples
Questions for Interviewer Strategic questions to ask at interviews

Each topic contains:

  • discussion.md — Best practices, structure, good vs bad examples, common mistakes
  • checklist.md — Drafting, refinement, and practice phases with practice log

Role-Specific (6 topics)

Topic Focus
Backend Engineer APIs, databases, services, scalability
Frontend Engineer DOM, frameworks, performance, accessibility
Data Engineer ETL, data pipelines, warehousing, streaming
ML/AI Engineer ML fundamentals, deployment, evaluation
DevOps/SRE CI/CD, containers, monitoring, reliability
Full-Stack Engineer Frontend + backend breadth, system integration

Each topic contains:

  • discussion.md — Core competencies, common topics, key terminology, cross-references
  • checklist.md — Per-competency prep checklist, practice questions, system design bridge

AI-Assisted Interview Scenarios (6 scenarios)

Practice modern project-based interviews where you collaborate with an AI assistant to build, debug, or extend production-like systems — the format used by Meta, LinkedIn, and Google.

Scenario Difficulty Key Skills
URL Shortener Medium Encoding, caching, database trade-offs
Spreadsheet Application Hard Dependency graphs, cycle detection, concurrency
Distributed Rate Limiter Hard Throttling algorithms, distributed state, resilience
Maze Solver / Pathfinder Medium Graph traversal, pathfinding, memory optimization
Card Game Logic Medium Game rules, extensibility, input validation
Notification Service Hard Async processing, idempotency, priority queuing

Each scenario contains:

  • README.md — Realistic interview prompt with requirements, starter code, and 4 progressive follow-up questions
  • TIPS.md — Key concepts, common mistakes, AI prompting strategy, and what interviewers look for

See ai_assisted/README.md for the full guide including interview formats, evaluation rubric, and prompting strategy.

Data Analytics (9 topics)

Topic Focus
Cohort & Retention D1/D7/D30 retention curves and cohort SQL
Data Quality Defense-in-depth monitoring and anomaly detection
Experiment Design A/B testing from hypothesis to ramp
Funnel Analysis Conversion drop-off diagnosis and attribution
North Star Metrics Choosing and decomposing the one metric
Product Sense Problem-first structured product reasoning
Scenario Problems DIAGNOSE framework for metric triage
SQL Foundations JOINs, NULLs, and CTE patterns
SQL Window Functions Ranking, LAG/LEAD, and frame clauses

Each topic contains:

  • discussion.md — Key concepts, definitions, common questions, reference tables
  • checklist.md — Concept self-assessment, explain-out-loud prompts, practice log

Low-Level Design (12 topics)

Topic Focus
Antipatterns Spot and fix six design anti-patterns
API Design Stable service contracts with idempotency and versioning
Behavioral Patterns Object communication and delegation patterns
Database Schema Design ER modeling, indexing, and online migrations
Design Framework SEDIE 5-step repeatable LLD interview method
Design Patterns Seven essential patterns for LLD interviews
LRU Cache O(1) cache with concurrency and distributed scaling
Parking Lot Multi-floor lot with spot matching and extensible pricing
Rate Limiter Thread-safe, algorithm-swappable rate limiter
Refactoring Patterns Incremental legacy modernization without big-bang rewrites
Shopping Cart Immutable snapshots, idempotent checkout, aggregate boundaries
UML Class Diagrams Correct relationship notation and Mermaid syntax

Each topic contains:

  • discussion.md — Key concepts, definitions, common questions, reference tables
  • checklist.md — Concept self-assessment, explain-out-loud prompts, practice log

Production Engineering (10 topics)

Topic Focus
AI Coding Tools Safe AI-assisted dev with generation, verification, learning loops
Capacity Planning Forecast load with uncertainty and tiered headroom policies
CI/CD Pipelines Safe fast delivery with test gates and deployment strategies
Cloud Cost Systematic spend reduction through rightsizing and FinOps
Code Review Structured review hierarchy from correctness to style
Feature Flags Decouple deploy from release with typed flag taxonomy
Performance Profiling Production profiling triage and flame graph reading
Postmortem Blameless root cause analysis with actionable items
Security Defense-in-depth across OWASP, secrets, and supply chain
SLO Error Budgets Measurable reliability through error budgets and burn rate

Each topic contains:

  • discussion.md — Key concepts, definitions, common questions, reference tables
  • checklist.md — Concept self-assessment, explain-out-loud prompts, practice log

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors