PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches

Quick Overview

This question evaluates practical skills in paginated API integration, data aggregation and grouping (clump formation), ID-to-name resolution with caching, error and rate-limit handling, and designing unit tests and complexity analysis within the Data Manipulation (SQL/Python) domain.

  • Medium
  • Peregrine
  • Data Manipulation (SQL/Python)
  • Software Engineer

Implement pagination and clump grouping

Company: Peregrine

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

You are given two pre-implemented APIs: ( 1) fetch_activities(page: int) -> { total_pages: int, activities: [ { activity_id: string, type: string, user_id: string, payload: object } ] }; ( 2) fetch_user_name(user_id: string) -> string. Perform the following: - Pagination and print: Call fetch_activities for all pages, obtain the total count, aggregate every activity across pages, and print each activity. - Group into clumps: Group activities by (type, user_name). Define a class Clump { type: string, name: string, activities: List[Activity] }. Return a list where each group is represented as a Clump, except when a group would contain exactly one activity—in that case return the single Activity object directly instead of a list/Clump. - Replace IDs with names: When printing, show user_name (fetched via fetch_user_name) instead of user_id. Minimize redundant user lookups (e.g., with caching), and handle API errors, rate limits, and timeouts gracefully. - Take‑home framing: Briefly describe how you would approach a take‑home variant where you must understand business context first, then aggregate the data, and finally filter results. State assumptions, edge cases, and validation steps. - Complexity and tests: Provide time/space complexity and outline unit tests, including pagination boundaries, empty pages, missing users, and mixed single-item vs multi-item clumps.

Quick Answer: This question evaluates practical skills in paginated API integration, data aggregation and grouping (clump formation), ID-to-name resolution with caching, error and rate-limit handling, and designing unit tests and complexity analysis within the Data Manipulation (SQL/Python) domain.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.