Day 21 — Review + Phase 1 Assessment
Coding problem
| Problem | Review + Phase 1 Assessment |
| LeetCode ID(s) | — |
| Difficulty | Mixed |
| Pattern | Review |
| Company tags | — |
| Suggested time | 30m |
Solution outline (coding)
- Skim Weeks 1–2 problem list; pick 1 easy + 1 medium you would not ace cold.
- Do a timed run: 15–20 min coding + 5 min complexity explanation.
- Grade against rubric: correctness, speed, communication, edge cases (empty, single node, overflow).
Time complexity: Varies — assessment simulation.
Space complexity: Varies.
Show Python solution
class ReviewDay:
"""Practice / review: Review + Phase 1 Assessment."""
def practice_plan(self):
return [
"Pick 2–3 problems from this phase; re-solve timed without notes.",
"For each: pattern name, time/space complexity, one alternative approach.",
]
# Input: (your choice of problems from this week or phase)
# Output: a short list of gaps to drill before the next sessionSQL interview practice
1. Interview question
Companies / track: Review / mixed (see weekly theme)
This is a review / mixed day. Expect SQL that blends data quality, funnels, and metric definitions—the same mix you see across consumer tech and ads analytics.
What you are asked to write (SQL prompt):
Review / mixed week — use the same tables and deliverables as in a standard onsite SQL round.
Using all Phase 1 tables, design a BigQuery job health dashboard: job run counts, failure rates, average runtime, and data freshness for each critical table.
Tables implied by the prompt:
- Infer schemas from the prompt and state them before coding.
Engine: BigQuery — use its date, array, and approximate functions as documented.
2. Solution outline
- Clarify out loud: result grain (one row per what?), join keys, time zone, and any
ORDER BY/LIMIT/ tie-breakers. - Map Review to SQL: say the relational equivalent (e.g. hash map →
GROUP BY+ key; two pointers → ordered window + filter). - Rates:
SAFE_DIVIDEorNULLIF; define numerator and denominator. - Structure: CTEs (
WITH) — one step per CTE; validate on a tiny slice (counts, nulls, duplicates).
Show SQL solution (BigQuery)
Main query
WITH jobs AS (
SELECT job_id, table_name, run_ts, status, runtime_sec
FROM job_runs
)
SELECT table_name,
COUNT(*) AS runs,
AVG(runtime_sec) AS avg_runtime,
COUNTIF(status != 'SUCCESS') / COUNT(*) AS failure_rate
FROM jobs
GROUP BY table_name;