Day 49 — Review + Phase 2 Assessment

Coding problem

ProblemReview + Phase 2 Assessment
LeetCode ID(s)
DifficultyMixed
PatternReview
Company tags
Suggested time30m

Solution outline (coding)

  • Mix DP problems: stairs, LIS, coin change — one timed each.
  • For each, write recurrence before code.
  • Collect one “state definition” mistake you tend to make.

Time complexity: Varies.

Space complexity: Varies.

Show Python solution
class ReviewDay:
  """Practice / review: Review + Phase 2 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 session

SQL 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.
Design a BigQuery-based test harness: store expected vs actual outputs for DP-style aggregations and detect regressions as logic evolves.

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).
  • Structure: CTEs (WITH) — one step per CTE; validate on a tiny slice (counts, nulls, duplicates).
Show SQL solution (BigQuery)

Main query

WITH expected AS (
  SELECT test_id, expected_json FROM regression_tests
),
actual AS (
  SELECT test_id, actual_json FROM regression_runs WHERE run_ts = (SELECT MAX(run_ts) FROM regression_runs)
)
SELECT e.test_id, TO_JSON_STRING(e.expected_json) = TO_JSON_STRING(a.actual_json) AS pass
FROM expected AS e
JOIN actual AS a USING (test_id);