Study Guides, Worked Examples & Common Pitfalls.
Every concept in SOARDO includes an intuitive explanation, a concrete worked example, and the exact pitfalls interviewers test—across Software Engineering, AI/ML, Data Analytics, Product Management, and Product Design.
Showing 118 of 118 public study guides
Data leakage
Data leakage happens when information from outside the training distribution—from future events or from the validation/test split—…
Read worked example & pitfalls →Model evaluation metrics
Accuracy fails on imbalanced datasets because predicting only the majority class yields high accuracy while missing every rare eve…
Read worked example & pitfalls →Model selection
Principled model selection starts with a simple fast baseline (dummy predictor or linear/logistic regression) to establish a lower…
Read worked example & pitfalls →Model validation
Model validation separates hyperparameter tuning from final performance estimation. Using a single train/test split to tune hyperp…
Read worked example & pitfalls →Neural networks
Neural networks compose linear weighted sums (Wx + b) with non-linear activation functions (ReLU, sigmoid, softmax) across layers.…
Read worked example & pitfalls →Model optimization
Gradient descent iteratively minimizes loss by stepping parameters opposite the loss gradient: w <- w - lr * grad(L). Learning rat…
Read worked example & pitfalls →Overfitting and regularization
Overfitting happens when a model fits noise and quirks in the training set instead of the underlying signal, producing high traini…
Read worked example & pitfalls →Data preprocessing
Data preprocessing cleans and transforms raw features before model fitting: imputing missing values, encoding categorical categori…
Read worked example & pitfalls →Supervised learning
Supervised learning maps labeled examples (input features X, ground-truth label y) to predictions: classification predicts discret…
Read worked example & pitfalls →Business analysis
Business analysis synthesizes SQL querying, visualization, and metrics into root-cause diagnosis and concrete action. Decompose a …
Read worked example & pitfalls →Business metrics
Business metrics turn raw product events into operational levers: Acquisition (signups, CAC), Activation (% reaching first core va…
Read worked example & pitfalls →Data cleaning
Data cleaning detects and fixes quality errors before analysis: duplicate rows, inconsistent date/string formats ("NY" vs "ny"), i…
Read worked example & pitfalls →Data visualization
Effective data visualization matches chart encoding to data type and question: line charts show continuous trends over time (alway…
Read worked example & pitfalls →SQL aggregation
SQL GROUP BY collapses rows sharing group keys into one summary row per group using aggregates (COUNT, SUM, AVG, MIN, MAX). Rememb…
Read worked example & pitfalls →SQL filtering
SQL WHERE filters individual rows BEFORE any grouping or aggregation runs. Combine predicates carefully with AND (both conditions …
Read worked example & pitfalls →SQL joins
INNER JOIN keeps only keys present in BOTH tables. LEFT JOIN preserves ALL rows from the left table, filling unmatched right-table…
Read worked example & pitfalls →Statistical inference
Statistical inference tests whether sample differences reflect real population effects or random sampling noise. A p-value is P(ob…
Read worked example & pitfalls →Correlation and interpretation
Pearson correlation r measures linear association strength and direction between -1 and +1. Critical limits: (1) Correlation does …
Read worked example & pitfalls →Descriptive statistics
Descriptive statistics summarize center (mean, median, mode) and spread (standard deviation, IQR = Q3 - Q1). Mean incorporates eve…
Read worked example & pitfalls →Product discovery
Product discovery reduces value risk ("will users want this?") and usability risk before engineering builds full software. Core te…
Read worked example & pitfalls →Product experimentation
A/B experimentation tests a causal hypothesis by randomly splitting eligible users into Control (status quo) and Treatment (change…
Read worked example & pitfalls →Product metrics
Good product metrics measure sustained user value (leading indicators & retention) and pair a primary goal with guardrail metrics …
Read worked example & pitfalls →Outcome measurement
Outputs are features shipped ("launched 4 dashboard widgets in Q2"); outcomes are measurable changes in user behavior and business…
Read worked example & pitfalls →Product prioritization
Prioritization allocates scarce engineering time toward the highest expected outcome relative to effort and confidence—never just …
Read worked example & pitfalls →Product problem framing
Problem framing defines WHAT user pain exists, WHO experiences it, and WHY it matters BEFORE debating solutions. Good problem stat…
Read worked example & pitfalls →Stakeholder management
Effective stakeholder management translates raw executive/sales feature demands into underlying business outcomes, shares decision…
Read worked example & pitfalls →Design accessibility
Accessibility ensures people using keyboards, screen readers, zoom, or with low vision can perceive and operate every flow. Key WC…
Read worked example & pitfalls →Design critique
Design critique evaluates whether a solution achieves user and business goals against research evidence and hierarchy principles—n…
Read worked example & pitfalls →Design systems
A design system unifies reusable UI components, semantic design tokens (color, spacing, type scale, radii—e.g. `--surface-card`, `…
Read worked example & pitfalls →Interaction design
Interaction design shapes the dialogue between user and interface across states: default, hover/focus, loading/disabled, validatio…
Read worked example & pitfalls →Design problem framing
Design problem framing translates research findings into a clear User + Need + Insight ("How Might We" / UX problem statement) wit…
Read worked example & pitfalls →Usability evaluation
Usability evaluation synthesizes heuristic inspection and usability-test recordings by prioritizing issues using Severity = Freque…
Read worked example & pitfalls →Usability testing
Usability testing evaluates a design by asking representative users to complete realistic goal-oriented tasks while thinking aloud…
Read worked example & pitfalls →User research
User research uncovers actual user behaviors, mental models, and pain points before designing screens. Strong interview questions …
Read worked example & pitfalls →Visual hierarchy
Visual hierarchy guides attention in intentional reading order using size, weight contrast, spacing (proximity), alignment, and re…
Read worked example & pitfalls →Wireframing
Low-fidelity wireframes explore layout, information architecture, user flows, and content priority quickly BEFORE spending hours o…
Read worked example & pitfalls →Array Basics: Traversal, Insertion & Deletion
Arrays store elements in contiguous memory slots, giving O(1) random access by index (base_address + index * element_size). Becaus…
Read worked example & pitfalls →Basic Bit Operations & Tricks
Bitwise operators manipulate individual binary bits directly in O(1) CPU instructions: AND (&) masks bits (1 only if both bits are…
Read worked example & pitfalls →1D DP: Fibonacci, Climbing Stairs & House Robber
Dynamic Programming solves problems with **overlapping subproblems** and **optimal substructure** by storing subproblem results on…
Read worked example & pitfalls →Graph Representation: Adjacency List & Matrix
Graphs connect vertices `V` via edges `E` (directed/undirected, weighted/unweighted). An **Adjacency List** (`adj[u] = [(v, w), ..…
Read worked example & pitfalls →Greedy Fundamentals: Activity Selection & Intervals
Greedy algorithms make the locally optimal choice at each step (typically after sorting by end time, deadline, or ratio) NEVER rev…
Read worked example & pitfalls →Hash Maps & Hash Sets
A hash map converts keys to array bucket indices via a hash function, supporting O(1) average insert, lookup, and delete in O(n) s…
Read worked example & pitfalls →Singly Linked List: Insert, Delete & Reverse
A singly linked list links nodes via next pointers instead of contiguous memory. Access to the k-th node is O(k), while inserting …
Read worked example & pitfalls →Recursion Fundamentals
Recursion solves a problem by reducing it to smaller self-similar subproblems until hitting a base case that returns directly with…
Read worked example & pitfalls →Binary Search & Variants
Binary search finds a target or boundary in a monotonic/sorted search space in O(log n) time and O(1) iterative space by halving t…
Read worked example & pitfalls →Stack: Implementation & Applications
A stack follows Last-In-First-Out (LIFO): push, pop, and peek all run in O(1). Stacks naturally model nested structures, expressio…
Read worked example & pitfalls →Binary Trees: Traversals & Properties
Every node in a binary tree has at most two children (`left`, `right`), making recursive divide-and-conquer natural: answer for `r…
Read worked example & pitfalls →Two Pointers
The two-pointers technique replaces nested O(n^2) loops with a single O(n) scan in O(1) extra space using two indices moving monot…
Read worked example & pitfalls →Advanced XOR Tricks & Bitmask DP
Advanced bit manipulation pairs XOR properties (`x ^ x = 0`) with bitmask DP (`mask` from `0` to `(1 << n) - 1`) to track visited …
Read worked example & pitfalls →2D DP: Grid Problems & Edit Distance
2D Dynamic Programming models grid coordinates `(r, c)` or string prefix alignments `(i, j)`. For Edit Distance (`Levenshtein`), `…
Read worked example & pitfalls →BFS & DFS on Graphs
Graphs can contain CYCLES and disconnected components, so both BFS and DFS require a `visited` set and an outer `for node in range…
Read worked example & pitfalls →Advanced Greedy: Huffman Coding & Job Scheduling
Advanced greedy problems use a **priority queue (`min-heap` / `max-heap`)** when choices dynamically create new sub-items—such as …
Read worked example & pitfalls →Collision Resolution Strategies
Hash collisions occur when two distinct keys map to the same bucket index (`hash(k1) % capacity == hash(k2) % capacity`). Two core…
Read worked example & pitfalls →Doubly Linked List
A doubly linked list stores `prev` and `next` pointers on every node. Given a direct reference to node `X`, you can remove `X` or …
Read worked example & pitfalls →Backtracking: Subsets, Permutations & N-Queens
Backtracking explores a decision tree recursively via **Choose -> Explore -> Unchoose (`pop` / undo mutation)**, pruning invalid b…
Read worked example & pitfalls →Merge Sort, Quick Sort & Heap Sort
Understanding O(n log n) comparison sorts guides engineering trade-offs: **Merge Sort** guarantees worst-case `O(n log n)` and **s…
Read worked example & pitfalls →Queue & Deque
A Queue is FIFO (First-In, First-Out): `enqueue` adds to the back and `dequeue` removes from the front, preserving arrival order—c…
Read worked example & pitfalls →Binary Search Trees
A Binary Search Tree enforces a **global subtree invariant**: EVERY value in `node.left` is strictly `< node.val`, and EVERY value…
Read worked example & pitfalls →Sliding Window
Sliding window maintains a contiguous range `[left..right]` dynamically, reusing prior window state in O(n) total time instead of …
Read worked example & pitfalls →Knapsack Variants
0/1 Knapsack chooses at most ONE copy of each item `(w, v)` up to capacity `W` (`dp[i][c] = max(dp[i-1][c], v + dp[i-1][c - w])`).…
Read worked example & pitfalls →Topological Sort
Topological Sort orders every vertex of a Directed Acyclic Graph (DAG) so for every prerequisite edge `u -> v`, `u` appears BEFORE…
Read worked example & pitfalls →Fast & Slow Pointers / Cycle Detection
Floyd’s tortoise-and-hare moves `slow` by 1 step and `fast` by 2 steps each iteration, achieving O(n) time and O(1) extra space (v…
Read worked example & pitfalls →Monotonic Stack / Queue
A Monotonic Stack stores **indices** maintaining strictly increasing or decreasing values from bottom to top, solving "Next Greate…
Read worked example & pitfalls →BFS & DFS on Trees
BFS (Breadth-First Search) uses a FIFO `deque` to process the tree level-by-level (`for _ in range(len(q)):` snapshots the exact l…
Read worked example & pitfalls →Prefix Sum & Difference Arrays
A prefix sum array `pref` precomputes cumulative sums (`pref[0] = 0`, `pref[i+1] = pref[i] + nums[i]`) in O(n) setup time so ANY s…
Read worked example & pitfalls →LCS, LIS & Subsequence Problems
Longest Common Subsequence (LCS) compares prefixes of two strings: `if a[i-1] == b[j-1]: 1 + dp[i-1][j-1]`, else `max(dp[i-1][j], …
Read worked example & pitfalls →Shortest Path: Dijkstra & Bellman-Ford
Dijkstra’s algorithm finds single-source shortest paths on **non-negative weighted** graphs in `O((V + E) log V)` using a min-heap…
Read worked example & pitfalls →Heap / Priority Queue
A binary heap (priority queue) maintains only a partial parent-<=children invariant inside a flat array (`left = 2i+1`, `right = 2…
Read worked example & pitfalls →Tries / Prefix Trees
A Trie (Prefix Tree) stores strings character-by-character along shared prefix paths (`root -> "c" -> "a" -> "t"`), supporting `in…
Read worked example & pitfalls →String Manipulation & Pattern Matching
In Python/JS/Java, strings are IMMUTABLE—concatenating character-by-character inside a loop (`s += ch`) copies the entire growing …
Read worked example & pitfalls →Union-Find / Disjoint Sets
Union-Find (Disjoint Set Union) tracks connected components cleanly under dynamic edge additions using `find(x)` and `union(a, b)`…
Read worked example & pitfalls →Minimum Spanning Tree: Kruskal & Prim
A Minimum Spanning Tree (MST) connects all `V` vertices of a connected undirected weighted graph using exactly `V - 1` acyclic edg…
Read worked example & pitfalls →OAuth2 Password Flow & JWT Tokens
OAuth2 Bearer JWT auth extracts tokens cleanly via `OAuth2PasswordBearer` / `HTTPBearer` and MUST cryptographically verify signatu…
Read worked example & pitfalls →Project Setup & Running with Uvicorn
A FastAPI service instantiates `app = FastAPI(title=...)`, mounts route decorators cleanly (`@app.get("/health")`), and runs via a…
Read worked example & pitfalls →BackgroundTasks for Post-Response Work
FastAPI `BackgroundTasks` runs lightweight in-process post-response jobs (`background_tasks.add_task(send_welcome_email, email)`) …
Read worked example & pitfalls →SQLAlchemy ORM with FastAPI
SQLAlchemy 2.0 separates `select(Model).where(...)` queries, explicit transaction commits (`db.commit()` / `with db.begin():`), an…
Read worked example & pitfalls →Depends() & Function Dependencies
FastAPI `Depends()` builds clean composable dependency trees for auth (`get_current_user`), pagination (`PaginationParams`), and s…
Read worked example & pitfalls →HTTPException & Custom Exception Handlers
Raise `HTTPException(status_code=404, detail="Mission not found")` for expected client/resource errors (`400/401/403/404/409`), an…
Read worked example & pitfalls →CORS Middleware Configuration
Browsers block cross-origin JavaScript requests unless the backend explicitly responds to `OPTIONS` preflight + actual requests wi…
Read worked example & pitfalls →TestClient & pytest Setup
`fastapi.testclient.TestClient(app)` runs your full FastAPI app in-process (zero network port wait!) backed by `httpx`, executing …
Read worked example & pitfalls →Password Hashing & Token Verification
Never store plaintext or fast SHA-256 passwords—use salted adaptive hashing (`Argon2id` or `bcrypt` via `pwdlib`/`passlib`) which …
Read worked example & pitfalls →Path Operations: GET, POST, PUT, DELETE
FastAPI evaluates routes **in registration order**! Place static paths (`/users/me`) **BEFORE** parameterized paths (`/users/{user…
Read worked example & pitfalls →Async Route Handlers & Event Loops
FastAPI handles **`def`** vs **`async def`** endpoints differently under the hood! Plain **`def`** routes run automatically inside…
Read worked example & pitfalls →Async Database with asyncpg & SQLAlchemy Async
High-concurrency FastAPI `async def` routes pair `create_async_engine("postgresql+asyncpg://...")` and `AsyncSession` (`async with…
Read worked example & pitfalls →DB Session Dependency Pattern
Database sessions MUST use a **`yield` dependency**: `session = SessionLocal(); try: yield session; finally: session.close()` (rol…
Read worked example & pitfalls →Validation Error Customization
When Pydantic fails request parsing, FastAPI raises `RequestValidationError` returning `422 Unprocessable Entity` with detailed `l…
Read worked example & pitfalls →Custom Middleware for Logging & Timing
Custom HTTP middleware (`@app.middleware("http")` or pure ASGI middleware) wraps every request/response for timing (`X-Process-Tim…
Read worked example & pitfalls →AsyncClient with httpx for Async Routes
When testing **`async def`** routes touching an `AsyncSession` / `asyncio` primitives directly (`@pytest.mark.asyncio` / `pytest-a…
Read worked example & pitfalls →Path Params, Query Params, Headers & Cookies
FastAPI routes parameters cleanly by origin: path parameters appear inside `{...}` in the route template; scalar parameters NOT in…
Read worked example & pitfalls →Request Body with Pydantic Models
Pydantic `BaseModel` parameters automatically parse, type-validate, and coerce incoming JSON request bodies, returning clean `422`…
Read worked example & pitfalls →Response Models, Status Codes & JSONResponse
Setting `response_model=PublicUserOut` and `status_code=status.HTTP_201_CREATED` filters, validates, and documents outgoing respon…
Read worked example & pitfalls →asyncio Event Loop & async/await Basics
`async def` defines a coroutine object whose execution pauses at `await`, yielding control back to the single-threaded event loop …
Read worked example & pitfalls →Lists & Tuples: Operations & Slicing
Lists (`[...]`) are mutable dynamic arrays supporting O(1) append/pop-end and O(k) slicing (`items[start:stop]`, which copies a sl…
Read worked example & pitfalls →try/except/finally & Raising Exceptions
Use `try / except SpecificError / else / finally` to catch ONLY the failure modes you actually know how to handle, leaving unexpec…
Read worked example & pitfalls →itertools Module
`itertools` provides C-speed lazy building blocks: `islice(iter, n)` slices streams/generators in O(1) space without converting to…
Read worked example & pitfalls →File Reading & Writing with Context Managers
Always open files using a `with open(path, mode, encoding="utf-8") as f:` context manager so the OS file descriptor ALWAYS closes …
Read worked example & pitfalls →Classes, Objects & __init__
Classes bundle data attributes and cohesive behavior via `__init__(self, ...)` and instance methods receiving `self`. Attributes d…
Read worked example & pitfalls →Variables, Data Types & Type Casting
Form inputs and CSV/JSON strings arrive as text (`str`), where `"12" + "3"` concatenates to `"123"` instead of adding numbers! Con…
Read worked example & pitfalls →pytest: Fixtures, Parametrize & Assertions
Pytest tests use plain `assert` statements, `@pytest.mark.parametrize` to cover normal + boundary + invalid inputs without copy-pa…
Read worked example & pitfalls →Type Annotations: Optional, Union, List & Dict
Type hints (`str | None`, `list[int]`, `dict[str, float]`, `TypedDict`, `Protocol`) document function contracts explicitly so stat…
Read worked example & pitfalls →asyncio.gather, Tasks & Concurrency Patterns
`await task1(); await task2()` sequentially waits for `task1` before starting `task2`! Wrap independent coroutines in `asyncio.gat…
Read worked example & pitfalls →Dicts & Sets: Operations & Use-Cases
Dicts map hashable keys to values with O(1) average lookup/insert (`counts[k] = counts.get(k, 0) + 1`). Sets store unique hashable…
Read worked example & pitfalls →Custom Exception Classes
Custom exceptions subclass `Exception` (NEVER `BaseException`, which catches `SystemExit`/`KeyboardInterrupt`) and carry domain-me…
Read worked example & pitfalls →functools Module: partial, lru_cache & reduce
`functools` supplies higher-order helpers cleanly: `@lru_cache(maxsize=...)` (or `@cache`) memoizes pure functions automatically (…
Read worked example & pitfalls →os & pathlib Modules
Use `pathlib.Path` over fragile string concatenation (`folder + "/" + file`): `/` operator (`Path("data") / "2026" / "out.csv"`) n…
Read worked example & pitfalls →Inheritance, MRO & super()
Use Inheritance (`is-a`) strictly when subclasses share and honor the parent’s behavioral contract (Liskov Substitution), calling …
Read worked example & pitfalls →Conditionals, Loops & List Comprehensions
A loop visits each element in sequence and an `if` guard filters or branches based on exact conditions—choose `<` vs `<=` and `>` …
Read worked example & pitfalls →unittest.mock & pytest-mock
Mocking isolates unit tests from slow/flaky external boundaries (HTTP APIs, clocks, emails) cleanly using `unittest.mock.patch` or…
Read worked example & pitfalls →Pydantic Models for Data Validation
Pydantic `BaseModel` turns type annotations into strict **runtime boundary parsing & validation** (powering FastAPI request/respon…
Read worked example & pitfalls →collections Module: deque, Counter, defaultdict
Python `collections` provides specialized containers tuned for common algorithmic patterns: `deque` gives O(1) `appendleft()`/`pop…
Read worked example & pitfalls →Generators & Yield
Generators (`yield` or `(x for x in seq)`) compute values **lazily one item at a time** in **O(1) memory** instead of materializin…
Read worked example & pitfalls →JSON & CSV Parsing
`json.loads` / `json.dumps` parse/serialize JSON strings cleanly (`load`/`dump` work on file streams), rejecting comments, trailin…
Read worked example & pitfalls →Magic/Dunder Methods (__str__, __len__, __eq__)
Magic (dunder) methods hook custom classes cleanly into Python’s built-in syntax: `__repr__` gives developers an unambiguous debug…
Read worked example & pitfalls →Functions, Arguments, Lambda & Scope
Functions encapsulate reusable logic with explicit parameters, pure return values, and predictable scope (LEGB rule: Local -> Encl…
Read worked example & pitfalls →heapq Module for Priority Queues
Python’s standard `heapq` operates directly on a regular Python `list` as an in-place binary MIN-heap: `heappush(h, x)` and `heapp…
Read worked example & pitfalls →Decorators & @property
A decorator wraps a function/method cleanly (`fn = log_calls(fn)`) to add cross-cutting behavior (timing, auth guards, retries, ca…
Read worked example & pitfalls →Built-in Functions & Standard Operators
Python built-in functions (`len`, `sum`, `min`, `max`, `sorted`, `enumerate`, `zip`, `any`, `all`) replace brittle manual index co…
Read worked example & pitfalls →Dataclasses & NamedTuples
`@dataclass` auto-generates clean `__init__`, readable `__repr__`, and field-wise `__eq__` for data-holding classes without boiler…
Read worked example & pitfalls →