Skip to content

Repository files navigation

AI-ML-LeetCode-Prep

🧠 AI/ML Engineer LeetCode & System Design Interview Prep

561 solved LeetCode problems, ML algorithm implementations, and system design writeups — a complete interview prep kit for AI/ML Engineer roles at FAANG, OpenAI, Anthropic, DeepMind, NVIDIA, and AI-first startups.

8 study guides covering every round of the MLE interview loop — DSA, ML coding, SQL, Pandas, NumPy, statistics, Python deep-dive, and ML system design — plus 561 solved files with runnable code and interview-grade writeups.


📂 Repository Structure

├── guides/                    # 📖 Study guides (read these first)
│   ├── Python_Leetcode.md           400+ DSA problems by pattern
│   ├── MLCoding_Leetcode.md         ML algorithms from scratch
│   ├── SQL_Leetcode.md              75+ SQL problems by pattern
│   ├── Pandas_Leetcode.md           47 Pandas problems
│   ├── NumPy_Fluency_Leetcode.md    NumPy fluency drills
│   ├── Python_Concepts_Leetcode.md  Python language deep-dive
│   ├── Stats_Probability_Leetcode.md Stats & probability
│   └── ML_System_Design_Leetcode.md ML system design framework
│
├── python/                    # ✅ 208 DSA solutions (pylint 10.00/10)
├── ml-coding/                 # ✅  65 ML algorithm implementations
├── sql/                       # ✅  93 SQL solutions (MySQL)
├── pandas/                    # ✅  73 Pandas solutions (pylint 10.00/10)
├── numpy-drills/              # ✅  35 NumPy fluency drills
├── stats-probability/         # ✅  31 stats implementations
├── python-concepts/           # ✅  33 Python concept demos
└── ml-system-design/          # ✅  23 system design writeups

🎯 How Guides Map to Interview Rounds

Interview Round Primary Guide Answersheet Files
DSA Coding (1–2 rounds) Python_Leetcode.md python/ 208
ML Coding (from scratch) MLCoding_Leetcode.md ml-coding/ 65
SQL / Data Round SQL_Leetcode.md sql/ 93
SQL / Data Round (Pandas) Pandas_Leetcode.md pandas/ 73
NumPy Fluency NumPy_Fluency_Leetcode.md numpy-drills/ 35
Stats / Probability Stats_Probability_Leetcode.md stats-probability/ 31
Python Screen Python_Concepts_Leetcode.md python-concepts/ 33
ML System Design ML_System_Design_Leetcode.md ml-system-design/ 23

🎒 Who This Repo Is For

✅ This repo is for you if

  • You are a CS / IT / ECE graduate (or final-year student) targeting MLE / SWE / Data Science roles
  • You have basic Python — you can write loops, functions, and classes without Googling syntax
  • You want to crack FAANG-style AI/ML interviews end-to-end: coding, ML, SQL, stats, and system design
  • You are willing to put in 8–10 weeks of focused prep

⚠️ Prerequisites

Before starting, you should already have:

Skill Minimum Bar Where to build it if missing
Python basics Variables, loops, functions, classes, list comprehensions Python.org tutorial — 1 week
High-school math Algebra, basic probability (coin flips, dice) Khan Academy — a few days
Linear algebra basics Vectors, matrices, dot products 3Blue1Brown Essence of LA — 4 hrs
ML awareness Know what train/test split, overfitting, and gradient descent mean conceptually fast.ai Practical ML — weekend
SQL basics SELECT, WHERE, GROUP BY, JOIN SQLZoo — 2–3 days

❌ Not for you if

  • Total beginner to programming — learn Python fundamentals first
  • Looking for ML theory textbook (this is interview-focused, not research-focused)
  • Want PyTorch / deep learning implementation depth — this repo covers ML algorithms from scratch with NumPy, not framework-level DL training

🧭 Skill-Level Entry Points

Your background Where to start
Fresh grad, weak DSA Week 1: python/01-arrays-hashing/ Easy tier
Know DSA, weak ML Skip to Week 3: ml-coding/
Strong coder, weak system design Jump to Week 7: ml-system-design/
Only need SQL/data round sql/ + pandas/ in parallel
Refreshing stats for interviews stats-probability/ Easy → Medium

🚀 Quick Start

1. Pick your weakest round

Read the guide first, then work through the answersheet.

2. Run any solution

# DSA
python python/01-arrays-hashing/0001_two_sum.py        # → All tests passed.

# ML Coding
python ml-coding/05-knn/knn_classifier.py              # → All tests passed.

# Stats
python stats-probability/07-ab-testing/sample_size_calculation.py

# NumPy
python numpy-drills/06-broadcasting/five_patterns.py

# Python Concepts
python python-concepts/03-decorators/timer_retry.py

3. Lint any answersheet

cd python && python -m pylint **/*.py --rcfile=.pylintrc    # → 10.00/10
cd ml-coding && python -m pylint **/*.py --rcfile=.pylintrc # → 10.00/10

📊 Answersheet Standards

Every Python answersheet follows the same quality bar:

Standard Enforced
PEP 8 compliance pylint 10.00/10 with per-folder .pylintrc
Type hints from __future__ import annotations on every file
Self-testing python file.pyAll tests passed.
Self-contained No cross-file imports; each file runs independently
Teaching docstrings Math, intuition, interview context, ML connection
Numerical stability Softmax overflow, log-of-zero, division-by-zero handled

SQL files follow MySQL dialect with uppercase keywords, teaching headers, and self-contained schema blocks.

ML System Design files follow the 8-step framework with real tools, metrics, and latency numbers.


📅 Suggested Study Plan

Week Focus Daily Target
1–2 DSA Easy + Medium (python/) 3 problems/day
3 ML Coding Easy + Medium (ml-coding/) 2 implementations/day
4 SQL + Pandas (sql/, pandas/) 3 problems/day (both syntaxes)
5 NumPy drills + Stats Easy/Medium 2 drills + 1 concept/day
6 Python Concepts + Stats Hard 2 concepts/day + explain out loud
7–8 ML System Design (timed 45-min walkthroughs) 1 design/day

Target pace: 2–3 items/day. Re-attempt anything unsolved in 20 min (15 min for SQL/Pandas).


🔗 Cross-Skill Practice

  • SQL ↔ Pandas: Same problems in both syntaxes — solve each in both.
  • NumPy → ML Coding: Master broadcasting and vectorization before attempting ML algorithms from scratch.
  • Stats → ML System Design: A/B testing knowledge feeds directly into the evaluation step of every system design.
  • Python Concepts → Everything: OOP, generators, and decorators appear in every coding round.

📋 Progress Tracker

Answersheet Easy Medium Hard Total Status
Python DSA 208 Complete
ML Coding 65 Complete
SQL 93 Complete
Pandas 73 Complete
NumPy Drills 35 Complete
Stats & Probability 31 Complete
Python Concepts 33 Complete
ML System Design 23 Complete
Total 561 ✅ All Complete

License

MIT

About

A focused AI/ML LeetCode prep repo with curated interview-ready Python solutions, ML implementations, and study guides for data science and ML engineers.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages