Class Design: Roller Coaster Scoring & Airline Pricing
- Turn input lines into typed objects behind a base class and one subclass per type
- Score roller coasters with type-specific rules, then swap the type switch for a register step
- Price airline tickets from per-airline operating and ticketing costs
- Answer the 100-airlines follow-up by moving shared-shape rules into config
Most Zoox coding screens skip the LeetCode puzzle. You get 10 to 15 minutes of trivia in the language you picked, then one practical problem built from classes, and it has to run. In May 2026 an infrastructure candidate solved theirs efficiently without following Python OOP principles and wasn't invited onsite. The class design is graded along with the answer.
Both problems in this lesson share one shape. Lines of text come in, each describes an item of some type, and each type has its own rule for the number you compute. Roller coaster scoring is the newest, from an October 2026 onsite. Airline ticket pricing has been around since at least 2021.
The shape behind both problems
Each line names a type and then some values. Keep three jobs apart. One function parses a line into fields, a factory picks the class for the type, and the class computes the number. Then each follow-up lands in one spot. A new type means a new subclass, and a file too big for memory only changes the loop that reads it.
class Item: def __init__(self, name, values): self.name = name self.values = values def shared_part(self): return 0.0 # the math every type has in common def own_part(self): return 0.0 # each subclass overrides this def result(self): return self.shared_part() + self.own_part()class TypeA(Item): def own_part(self): return 1.0 # TypeA's own ruleTYPES = {"a": TypeA} # type word -> classdef handle(line): kind, name, *values = line.split() item_class = TYPES.get(kind) if item_class is None: return name + " invalid" return "%s %.1f" % (name, item_class(name, values).result())Write the shared formula once in the base class and let each subclass fill in only what differs. The next question is usually a new type or a hundred of them, and with this layout you answer by adding a class or a row of data. The code that adds things up never moves.
Roller coaster scoring
The newest named Zoox class problem came up on the first day of an October 2026 onsite, right after Go output-prediction trivia in the same round. The candidate called it "the classic roller coaster." You read lines describing roller coasters of several types and compute each one's score with rules that depend on its type. They finished one type before time ran out. The interviewer said the others were close to copy-paste and error handling could be skipped.
At the end the interviewer asked what else they'd improve, besides error handling. The candidate had two answers. Read a large input one line at a time instead of loading it all, and register each coaster type through a Register() function instead of switching on the type. A May 2026 machine learning engineer technical screen carried the same title, with the weight on string parsing, floating-point math and conditional logic.
The exact coaster types and formulas aren't public, so the problem below is something like it, with three types and made-up rules that keep the shape. A July 2023 senior screen asked for a score calculator that handles diverse input conditions. That may be an earlier form of this problem, though nothing confirms the two are the same.
Roller Coaster Scoring
Problem
score_coasters(lines). Each line describes one roller coaster as type name speed height extra, separated by spaces. Speed is the top speed in mph and height is the biggest drop in feet. Names have no spaces. Return one string per non-blank line, in input order, as name score with the score to one decimal place.Every coaster starts from a base score of
0.8 * speed + 0.2 * height, and its type adds a bonus from the extra field. A steel coaster's extra is its inversion count, worth 5 points each. For wooden, the extra is its age in years, and it earns 10 points once it's 50 or older. On a launched coaster it's the launch time in seconds, worth 3 * (10 - launch) points but never below 0.Skip blank lines. Every other line starts with a type and a name. A line with an unknown type, the wrong number of fields or a value that isn't a number gives
name invalid.Comet scores 74.4 + 62.0 from speed and height, plus 10 for two inversions. Timber is 19 years old, so it keeps its base score.
Give a base Coaster class the shared fields and the base score, and let each subclass override one bonus method. A small factory maps the type word to its class, and one parse function turns each line into a result string or nothing.
Roller Coaster Scoring
Click "Run" to execute your code
register("steel") decorator that adds each class to it when Python loads the file. The factory shrinks to one dict lookup. Then stream it. Read the file with for line in source and yield each result, so a million-line input holds one line in memory at a time. Both changes are worked in the solution.Airline ticket pricing
The airline ticket calculator is the longest-running Zoox screen problem. About a dozen candidates got it between January 2021 and September 2025, in software, SRE, motion planning, machine learning and intern loops. A cost estimation class problem was still being asked in October 2026 technical screens.
A 2023 screen gave input much like United 150.0 Economy, Southwest 150.0 Business and American 150.0 Premium. Operating cost changes per airline and so does ticketing cost, and you compute each ticket's price. The follow-up asked how the design holds up with 100 airlines that each calculate their costs differently.
How strictly the design gets judged has varied. In 2021 a candidate asked whether the interviewer wanted a design or a hard-coded calculation and was told to just make the input work. In 2022 another interviewer kept suggesting more OOP concepts rather than just getting the code to run. A 2024 senior candidate's advice was to write optimized Python and avoid unnecessary instances. The rates below are made up for practice.
Airline Ticket Pricing
Problem
ticket_prices(tickets). Each ticket is a line airline base seat, such as United 150.0 Economy. The base fare is a number and the seat is Economy, Premium or Business. A ticket's price is its base fare plus the airline's operating cost plus its ticketing cost.United's operating cost is 50% of the base fare, and its ticketing cost is a flat 10, 25 or 40 for Economy, Premium and Business. Southwest's operating cost is 25% of the fare, with a flat ticketing cost of 5 in every seat. American's operating cost is 40% of the fare, and its ticketing cost is 10% of the fare, or 20% in Business.
Return one string per non-blank line, in order, as
airline price with the price to two decimal places. Airline names and seats are case-sensitive. A line with an unknown airline, an unknown seat, a fare that isn't a number or the wrong number of fields gives airline invalid, using its first word.United adds 75 operating and the 10 Economy fee. Southwest adds 37.50 and 5. American adds 60 and 15, since Premium pays the 10% rate.
Make an Airline base class whose price method adds the fare and the two costs. Each airline subclass overrides operating_cost and ticketing_cost. Build one instance of each airline up front and keep them in a dict keyed by name.
Airline Ticket Pricing
Click "Run" to execute your code
RateAirline class and build each airline from a row of config. Keep a real subclass only for an airline whose rule has a genuinely different form. The worked version is in the solution.What gets graded
Both problems get scored on how you split the work. Parsing sits in one function, each type's rule sits in its own class, and the shared math is written once in the base. Code that runs and prints the right numbers is the floor. A 2026 infrastructure candidate cleared that floor and still didn't get an onsite.
Common questions
What coding questions does Zoox ask?
For most software roles the technical screen is language trivia followed by one practical class problem like the two on this page. Onsite coding mixes in algorithm problems, and the stock-profit family has come back most often, through 2026. Motion-planning teams often swap in a C++ problem from their own domain.
How long is the Zoox technical screen?
About an hour. Recruiters in 2025 and 2026 described 10 to 15 minutes of trivia, though some earlier screens ran 20 to 30, and the rest goes to the coding problem. The code is expected to run, often in CoderPad against given test cases.
Which language should I use?
The one you're strongest in, since the trivia follows it. C++ and Python are the common picks, and an October 2026 candidate used Go. Teams that ship code on the vehicle may move you to C++ for the onsite even after a Python screen, as one 2024 candidate found.
Do I have to finish every part?
Not always. The October 2026 candidate finished one coaster type out of several, and the interviewer waved off the rest as copy-paste. A clean hierarchy with one type running gives you more to discuss than three types crammed into one function.
Key Takeaways
- ✓Zoox screens pair language trivia with one practical class problem that must run, and the class structure is graded too.
- ✓Roller coaster scoring is the newest, from an October 2026 onsite. Have streaming input and a register step ready as improvements.
- ✓Airline pricing is the screen staple, 2021 to 2025. Write the sum once in the base class and build each airline once.
- ✓For 100 airlines, move shared-shape rules into config rows and keep subclasses only for rules with a different form.
Zoox interview guideKnow what Zoox asks before you walk in.
21 coding · 4 system design · 30 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.