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.

Google
Data Manipulation (SQL/Python)
Data Scientist
Google
November 29, 2026
Data Scientist
Online Assessment
Data Manipulation (SQL/Python)
Easy

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
LAG
week over week
DATE_TRUNC
time series aggregation
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported