The Long Way Back
A hard SQL mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- SQL
- Difficulty
- hard
- Seniority
- L5
Interview Prompt
From our service health checks we track each service's monthly average uptime, and we want the services that slid downhill and then clawed their way back. Reading one service's months in time order, treat each unbroken run of falling months as a decline stretch and each unbroken run of rising months as a recovery stretch. Pair every decline stretch with each recovery stretch that begins after it, and for each pairing report the service, the month each stretch began, and how far the service climbed: the highest monthly average in the recovery stretch minus the lowest in the decline stretch, over that lowest.
Summary
Some services fell apart and clawed their way back. Find them, and measure the climb.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your sql solution with real code execution
- Get instant feedback and a hire/no-hire decision