Instacart

Instacart Software Engineer Onsite Coding Questions

6+ questions from real Instacart Software Engineer Onsite Coding rounds, reported by candidates who interviewed there.

6
Questions
5
Topic Areas
10+
Sources

What does the Instacart Onsite Coding round test?

The Instacart onsite coding round is the core technical evaluation. Software Engineer candidates typically see 2-3 algorithm and data structure problems. Problems range from medium to hard difficulty, and interviewers evaluate both correctness and code quality.

Top Topics in This Round

Instacart Software Engineer Onsite Coding Questions

Has anyone had an onsite interview for Instacart's frontend-focused position? The interviewer said it's like a regular interview with Instacart, with two coding rounds, but one of them will be fronten

LeetCode #1701: Average Waiting Time. Difficulty: Medium. Topics: Array, Simulation. Asked at Instacart in the last 6 months.

LeetCode #34: Find First and Last Position of Element in Sorted Array. Difficulty: Medium. Topics: Array, Binary Search. Asked at Instacart in the last 6 months.

LeetCode #49: Group Anagrams. Difficulty: Medium. Topics: Array, Hash Table, String, Sorting. Asked at Instacart in the last 6 months.

## Problem Given a list of records with dimensions and a metric, produce a pivot table. Rows are indexed by one dimension, columns by another, and cells contain an aggregated metric (sum or average). ```python def pivot_table( records: list[dict], row_dim: str, col_dim: str, metric: str, agg: str = "sum" # "sum" or "avg" ) -> dict[str, dict[str, float]]: ... ``` ``` Records: [{"region":"North","product":"A","sales":100}, {"region":"North","product":"B","sales":200}, {"region":"South","product":"A","sales":150}, {"region":"South","product":"A","sales": 50}] pivot_table(records, row_dim="region", col_dim="product", metric="sales", agg="sum") Output: { "North": {"A": 100, "B": 200}, "South": {"A": 200} # 150+50 } ``` ## Follow-ups 1. How do you handle missing combinations (e.g., South has no product B)? Return 0, null, or omit the key? 2. Add a `totals=True` option that appends row totals and a grand total column. Walk through the implementation. 3. Support a third dimension as a page filter (e.g., filter to only `year=2024` before pivoting). How does the function signature change? 4. If records come from a SQL database, write the equivalent SQL `GROUP BY` query with `CASE WHEN` column pivoting.

## Problem You are given an `(m+1) x (n+1)` matrix where the last row contains the XOR of each column and the last column contains the XOR of each row. One cell in the original `m x n` region is corrupted (flipped bits). Find the coordinates of the corrupted cell and restore its correct value. ```python def find_and_fix_corrupted( matrix: list[list[int]] ) -> tuple[int, int, int]: """Return (row, col, corrected_value).""" ... ``` ``` Original 2x2 (with checksums as 3x3): 1 2 3 <- 3 = XOR of row 0 4 5 1 <- 1 = XOR of row 1 5 7 <- col XOR checksums Corrupt cell (0,1): 2 -> 9 1 9 3 4 5 1 5 12 Column 1 checksum: 9 XOR 5 = 12, expected 7 -> mismatch -> col=1 Row 0 checksum: 1 XOR 9 = 10, expected 3 -> mismatch -> row=0 Corrected value: 9 XOR 10 XOR 3 = 2 Output: (0, 1, 2) ``` ## Follow-ups 1. Prove that XOR of a row and its checksum equals 0 when uncorrupted. How does corruption change this? 2. What if two cells are corrupted? Can you still detect and fix them with this scheme? 3. How does this relate to RAID-5 parity? Describe the analogy. 4. Extend to 3D: a cube with checksum planes on all three faces. How do you locate a single corrupted voxel?

See All 6 Questions from This Round

Full question text, answer context, and frequency data for subscribers.

Get Access