Peregrine·Software Engineer·Technical Phone Screen
- You're given two pre-built API functions, one for paginated activity feeds and one for user name lookups. Walk through fetching all pages, aggregating the activities, and printing them with user names instead of user IDs.
- Group the fetched activities by type and user name into a Clump class. Groups with more than one activity become a Clump object, but groups with exactly one activity should just return the raw activity instead.
- How would you handle API errors, rate limits, and timeouts when calling these fetch functions?
- If this were a take-home problem, how would you approach it? Walk through understanding the business context, aggregating data, and filtering results, and call out your assumptions, edge cases, and validation steps.
- What's the time and space complexity of your solution? And what unit tests would you write, specifically covering pagination edge cases, empty pages, missing users, and mixed single vs multi-item clumps?
“The pagination part was fine, just loop until you hit total_pages.”