As reported: GoDaddy SDE 2 (Pune, remote team, 2025), round 3 — backend/API design, 1 hour: find the fastest marathon runner using a paginated API, focusing on efficient fetching, rate limits and failure handling. Follow-ups: optimising API calls for large data, handling API failures in production, and strict rate limits.
A marathon results service exposes one endpoint:
GET /runners?page=<n> (pages start at 1)
-> 200 { "page": 1, "total_pages": 50,
"runners": [ { "id": 17, "name": "Ana", "finish_seconds": 9123 }, ... ] }
finish_seconds is null for runners who did not finish. The service is rate-limited (it answers 429 Too Many Requests with a Retry-After header when you go too fast) and unreliable (occasional 5xx errors and timeouts).
Write a program that returns the fastest runner (smallest finish_seconds) across all pages. Fetch efficiently, respect the rate limit, and handle failures.
Then discuss:
- How would you optimise the API calls when there are millions of runners?
- How do you handle API failures in production?
- What changes under a very strict rate limit?