Pivot order-status counts
InstacartSoftware Engineer · OnsiteLast updated
This interview question evaluates algorithm design, data structures, correctness, complexity, edge cases, and implementation details in a realistic interview setting. A strong answer for Pivot order-status counts states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Question
Given an orders table (order_id, shopper_id, order_date, status, …), pivot the data so that each row is one shopper and each column shows the count of orders for a specific status (e.g., DELIVERED, CANCELED, RETURNED). Provide an efficient Java solution that works on a platform without external date-parsing libraries.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.