Day 77 — REVIEW — Meta Mock
Coding problem
| Problem | REVIEW — Meta Mock |
| LeetCode ID(s) | — |
| Difficulty | Mixed |
| Pattern | Review |
| Company tags | Meta |
| Suggested time | 30m |
Solution outline (coding)
- Revisit problems you missed from the Meta mock; re-solve without notes.
- Record patterns: intervals, graphs, system bits specific to that session.
- One timed redo of the hardest problem.
Time complexity: Varies.
Space complexity: Varies.
Show Python solution
class ReviewDay:
"""Practice / review: REVIEW — Meta Mock."""
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: Meta
Meta: expect event logging, ads / integrity, and social product analytics—deduping, sessionization, and window functions are frequent themes.
What you are asked to write (SQL prompt):
Frame this as metrics work for **Meta**-scale surfaces (ads, product, or engagement — as the tables suggest).
Store mock results (timing, bytes processed, correctness flags) in a BigQuery table and write queries to analyze where you lost performance or made mistakes.
Tables implied by the prompt:
results(timing, bytes processed, correctness flags)
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). - Windows: align
PARTITION BY/ORDER BYwith the business rule; useQUALIFYin BigQuery when you need top-N per group. - Cost: selective columns, partition pruning, avoid
SELECT *when tables are huge. - Structure: CTEs (
WITH) — one step per CTE; validate on a tiny slice (counts, nulls, duplicates).
Show SQL solution (BigQuery)
Main query
SELECT problem_id, AVG(duration_sec) AS avg_time, AVG(bytes_billed) AS avg_bytes
FROM mock_results
GROUP BY problem_id;