Compute Week-Over-Week Android Activation Growth by Country
Last updated: November 29, 2026
Quick Overview
From Android device activation records, compute weekly activations per country for the last eight complete weeks and week-over-week growth, only comparing truly consecutive weeks with a meaningful base.
0
0
0 solved
From Android device activation records, compute weekly activations per country for the last eight complete weeks and week-over-week growth, only comparing truly consecutive weeks with a meaningful base.
A short time series SQL item in the style of Google online assessments, framed around Android device growth reporting. The interviewer checks complete-week boundaries, LAG per country, and that a missing week does not produce a misleading comparison.
What the Interviewer Expects
- Truncate dates to Monday-start weeks and use complete weeks only
- Count distinct devices to avoid duplicate activation pings
- Use LAG per country for the prior week
- Verify the previous row is exactly one week earlier
- Filter tiny bases before ranking growth
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you adjust for a holiday week like Thanksgiving?
- Growth is high in a small country. How would you report significance?
- How would you show this as a share of global activations instead?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
android_activations(device_id, activated_at, country_code). A device can send more than one activation ping during setup, so I count distinct devices. Weeks start Monday; the current partial week is...
Approach
Aggregate to (country, week). LAG gives the previous row's week and count. Because a small country can have a week with no activations at all (no row), I also LAG the week and only keep rows where the...