PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Instacart

Implement multiple coding round problems

Last updated: Mar 29, 2026

Quick Overview

This multi-part question evaluates algorithmic problem-solving skills including efficient lookup/search, stable ordering and priority management, streaming algorithms under strict memory constraints, and expression parsing with variable substitution.

  • medium
  • Instacart
  • Coding & Algorithms
  • Software Engineer

Implement multiple coding round problems

Company: Instacart

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Solve the following **coding** problems. ## 1) Bus schedule (next departure) Given: - A sorted list `buses[]` of bus departure times (minutes since 00:00). - A list `arrivals[]` of passenger arrival times (minutes since 00:00). For each passenger, return the **earliest bus departure time** that is `>=` their arrival time, or `-1` if no such bus exists. **Constraints:** - `1 <= len(buses), len(arrivals) <= 2e5` - Times fit in 32-bit signed integers. ## 2) Priority boarding order You are given a list of passengers. Each passenger has: - `priority` (smaller number = higher priority, e.g. 0 is best) - `checkInTime` (integer) - `name` (string) Output the boarding order under these rules: 1. Higher priority boards first. 2. Within the same priority, earlier `checkInTime` boards first. 3. If still tied, preserve input order. **Follow-up:** If passengers arrive as a stream, how would you produce the next passenger to board efficiently? ## 3) Decode passwords from a stream with limited reads A file/stream contains multiple passwords encoded as `(index, char)` pairs in order of appearance. A password is defined by indices `0..L-1` appearing exactly once each, where `L` is the password length. Rules: - The **first password is guaranteed valid**. - When parsing the stream, encountering an `index` that has already appeared in the *current* password indicates the start of the **next** password (i.e., the pair you just read belongs to the next password). - You cannot load the full file into memory. You may only read in chunks whose size is at most the **length `L` of the first decoded password**. Return all decoded passwords in order. ## 4) Evaluate an arithmetic expression with up to two variables Given: - A string expression `expr` containing integers, `+` and `-`, parentheses `(` `)`, optional whitespace, and variable names consisting of letters. - The expression contains **at most two distinct variable names**. - A map of variable values (e.g., `{x: 3, y: 10}`), guaranteed to include any variables present. Compute and return the integer result. **Note:** You may not assume there are spaces between tokens.

Quick Answer: This multi-part question evaluates algorithmic problem-solving skills including efficient lookup/search, stable ordering and priority management, streaming algorithms under strict memory constraints, and expression parsing with variable substitution.

Related Interview Questions

  • Implement an In-Memory File Storage System - Instacart (medium)
  • Decode an encoded string - Instacart (medium)
  • Evaluate an arithmetic expression - Instacart (medium)
  • Implement worker time and payroll tracker - Instacart (hard)
  • Solve Two Sorted-Array Tasks - Instacart (hard)
Instacart logo
Instacart
Jan 1, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
16
0
Loading...

Solve the following coding problems.

1) Bus schedule (next departure)

Given:

  • A sorted list buses[] of bus departure times (minutes since 00:00).
  • A list arrivals[] of passenger arrival times (minutes since 00:00).

For each passenger, return the earliest bus departure time that is >= their arrival time, or -1 if no such bus exists.

Constraints:

  • 1 <= len(buses), len(arrivals) <= 2e5
  • Times fit in 32-bit signed integers.

2) Priority boarding order

You are given a list of passengers. Each passenger has:

  • priority (smaller number = higher priority, e.g. 0 is best)
  • checkInTime (integer)
  • name (string)

Output the boarding order under these rules:

  1. Higher priority boards first.
  2. Within the same priority, earlier checkInTime boards first.
  3. If still tied, preserve input order.

Follow-up: If passengers arrive as a stream, how would you produce the next passenger to board efficiently?

3) Decode passwords from a stream with limited reads

A file/stream contains multiple passwords encoded as (index, char) pairs in order of appearance. A password is defined by indices 0..L-1 appearing exactly once each, where L is the password length.

Rules:

  • The first password is guaranteed valid .
  • When parsing the stream, encountering an index that has already appeared in the current password indicates the start of the next password (i.e., the pair you just read belongs to the next password).
  • You cannot load the full file into memory. You may only read in chunks whose size is at most the length L of the first decoded password .

Return all decoded passwords in order.

4) Evaluate an arithmetic expression with up to two variables

Given:

  • A string expression expr containing integers, + and - , parentheses ( ) , optional whitespace, and variable names consisting of letters.
  • The expression contains at most two distinct variable names .
  • A map of variable values (e.g., {x: 3, y: 10} ), guaranteed to include any variables present.

Compute and return the integer result.

Note: You may not assume there are spaces between tokens.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Instacart•More Software Engineer•Instacart Software Engineer•Instacart Coding & Algorithms•Software Engineer Coding & Algorithms
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.