Year-over-Year Growth
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Table revenue:
region TEXT
year INTEGER
amount INTEGER
(one row per region and year; some years are missing for some regions)
For each region and year, return the change from the previous calendar year as a whole-number percentage, rounded to the nearest integer.
Columns, in this order: region, year, amount, growth percent.
Order by region, then year.
Growth percent is NULL when the region has no row for the previous calendar year, or when the previous year's amount was 0.
Examples
Constraints
- Growth can be negative.
- Integer division would truncate; the answer must be rounded.
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.