Day 89 — FULL MOCK: Weakest Topic
Coding problem
| Problem | FULL MOCK: Weakest Topic |
| LeetCode ID(s) | — |
| Difficulty | Mixed |
| Pattern | Mock |
| Company tags | — |
| Suggested time | 45m |
Solution outline (coding)
- From prior logs, pick the single weakest topic (e.g. DP, graphs, design).
- Do one targeted problem set only in that topic.
- Re-assess with one verification problem tomorrow.
Time complexity: Varies.
Space complexity: Varies.
Show Python solution
class ReviewDay:
"""Practice / review: FULL MOCK: Weakest Topic."""
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.
Weakest-topic mock: tag each prior SQL question by topic (window, partitioning, UDF, performance) and write a query to surface your weakest area from logged scores.
Tables implied by the prompt:
topic(window, partitioning, UDF, performance)
2. Solution outline
- Clarify out loud: result grain (one row per what?), join keys, time zone, and any
ORDER BY/LIMIT/ tie-breakers. - Map Mock to SQL: say the relational equivalent (e.g. hash map →
GROUP BY+ key; two pointers → ordered window + filter). - Filter time first: predicate on
DATE(ts)/ partition column before heavy joins; state the window in plain English. - Windows: align
PARTITION BY/ORDER BYwith the business rule; useQUALIFYin BigQuery when you need top-N per group. - Arrays / UDFs:
UNNESTand offsets for index; say when logic belongs in SQL vs a UDF. - 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 topic, AVG(score) AS avg_score FROM sql_topic_scores GROUP BY topic ORDER BY avg_score ASC LIMIT 3;