Day 56 — Review – Week 8

Coding problem

ProblemReview – Week 8
LeetCode ID(s)
DifficultyMixed
PatternReview
Company tags
Suggested time30m

Solution outline (coding)

  • Review serialize, topo, union-find, shortest path — pick the weakest.
  • Whiteboard the API of each algorithm (what you push/pop from heap).
  • Do one full implementation without IDE autocomplete.

Time complexity: Varies.

Space complexity: Varies.

Show Python solution
class ReviewDay:
  """Practice / review: Review – Week 8."""

  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.
Collect tree/graph stats (components, diameter estimates, height) into a summary table and design monitoring queries for structural changes.

Tables implied by the prompt:

  • stats(components, diameter estimates, height)

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).
  • Arrays / UDFs: UNNEST and offsets for index; say when logic belongs in SQL vs a UDF.
  • Structure: CTEs (WITH) — one step per CTE; validate on a tiny slice (counts, nulls, duplicates).
Show SQL solution (BigQuery)

Main query

SELECT 'components' AS metric, COUNT(*) FROM graph_component_stats
UNION ALL SELECT 'max_height', MAX(height_est) FROM tree_height_stats;