The Upstart online assessment contained four coding questions covering string parsing, order-preserving deduplication, anagram detection, and a stateful simulation involving restaurant seating and repeat customers.
The first three questions were relatively direct implementation tasks. The fourth was more involved because guest IDs could represent arrivals, departures, waiting customers, and repeat visits, and it also included an AI-generated follow-up about distinguishing different guest states.
Interview Details
Question 1 — Adjust Recipe Quantities
You are given a recipe written for one person and a positive integer nb_persons. Each ingredient is represented by a string beginning with a positive integer quantity, followed by a space and the ingredient description.
Only the leading quantity should be multiplied. Any numbers appearing later in the ingredient description must remain unchanged, and the original order of the ingredient lines must be preserved.
For example:
nb_persons = 4
ingredients = [
"3 tomatoes",
"120 grams of pasta",
"2 bottles of 5-spice sauce"
]
Output:
[
"12 tomatoes",
"480 grams of pasta",
"8 bottles of 5-spice sauce"
]
nb_persons = 4
ingredients = [
"3 tomatoes",
"120 grams of pasta",
"2 bottles of 5-spice sauce"
]
Output:
[
"12 tomatoes",
"480 grams of pasta",
"8 bottles of 5-spice sauce"
]
The task was to implement: adjust_quantities(nb_persons, ingredients) and return the transformed list.
Question 2 — Remove Duplicates While Preserving Order
Implement: filter_duplicates(data). Given an array, return the values with duplicate occurrences removed while preserving the order in which each distinct value first
Unlock Full Details
Create a free account to unlock this interview experience report.