PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches

Quick Overview

This question evaluates a candidate's competency in data manipulation and transformation, specifically pivoting tall datasets into wide views, handling missing metric values, ordering ISO date strings via string operations, and meeting algorithmic efficiency constraints (O(n log n)).

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

Pivot data without date libraries

Company: Instacart

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

Transform a tall dataset into a wide, pivoted view without using any date/time libraries. Input: a list of records (date, store_id, metric, value) where date is an ISO 8601 string YYYY-MM-DD, metric ∈ {"sales", "refunds", "visits"}, and value is a non-negative integer. Output: for each (store_id, date), produce one row with columns [store_id, date, sales, refunds, visits], filling missing metric values with 0 and ordering rows by ascending date within each store. Requirements: ( 1) Implement this in code (any language), but you may not import date/time packages; rely only on string operations for ordering dates. ( 2) Ensure the solution is O(n log n) or better with respect to the number of records n. ( 3) Explain how you would handle malformed dates, duplicate (store_id, date, metric) entries, and very large inputs that do not fit in memory.

Quick Answer: This question evaluates a candidate's competency in data manipulation and transformation, specifically pivoting tall datasets into wide views, handling missing metric values, ordering ISO date strings via string operations, and meeting algorithmic efficiency constraints (O(n log n)).

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.

Related Coding Questions

  • Write SQL to rank advertisers and profitability - Instacart (Medium)
  • Aggregate weekly revenue and attribute 4% drop - Instacart (Medium)
  • Explain handling very large datasets - Instacart (Medium)
  • Pivot transactions by date without date libs - Instacart (Medium)
  • Implement a pivot table transformation - Instacart (Medium)