InterviewLegend

Class Design: Roller Coaster Scoring & Airline Pricing

Alex Chen40 min readGuide updated
In this lesson
  • 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 Zoox angle
Build the class hierarchy first, even for a small input. A 2022 interviewer kept steering a candidate toward more OOP over code that merely worked, and a 2024 senior candidate's advice was to avoid unnecessary instances. A base class, one subclass per type and a lookup table usually cover it.

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.

python
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 rule
TYPES = {"a": TypeA} # type word -> class
def 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.

1

Roller Coaster Scoring

MediumFrequently asked
Problem
Write 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.
Inputlines = ["steel Comet 93 310 2", "wooden Timber 67 163 19"]Output["Comet 146.4", "Timber 86.2"]

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.

How this uses the pattern

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.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Roller Coaster Scoring

Loading...
Click "Run" to execute your code
The Zoox angle
Structure counted for more than finishing. The October 2026 candidate wrote one coaster type in full, and the interviewer called the rest near copy-paste. So one clean base class with a single finished subclass reads better than three rushed ones. Error handling was skippable, but say out loud which lines you'd reject. The round closed by asking what else you'd improve, so have both answers ready. Stream the input so memory stays flat, and let each type register itself so a new type never edits a switch. The May 2026 machine learning screen put the weight on parsing and float math, so format the score exactly.
Take it further
Replace the switch with Register(). Keep a dict from type word to class, plus a 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.

2

Airline Ticket Pricing

MediumSignature problem
Problem
Write 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.
Inputtickets = ["United 150.0 Economy", "Southwest 150.0 Business", "American 150.0 Premium"]Output["United 235.00", "Southwest 192.50", "American 225.00"]

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.

How this uses the pattern

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.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Airline Ticket Pricing

Loading...
Click "Run" to execute your code
The Zoox angle
The math is a few multiplications, so most of the grade rides on where you put it. Write the sum once in the base class and leave the two cost hooks to the subclasses. A 2024 description of a Zoox screen with this shape put it plainly: some base and derived class definitions, then logic in the base class for a calculation. Watch the instance count too. Creating a new United object for every ticket is the unnecessary-instance habit a 2024 candidate warned against. Build each airline once, keep them in a dict and reuse them.
Take it further
What if there are 100 airlines with different rules? A hundred subclasses that differ only in their numbers is a smell. Most airlines fit one shape, a rate on the fare plus a fee or a rate per seat, so write one 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.

Say the design before you type it. Name the base class, the hook each subclass fills and the lookup that picks the class. Then write one type completely and run it. If the second type takes a minute to add, point that out. It shows the structure doing its job, and it covers you if time runs out the way it did for the October 2026 candidate.

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 guide

Know what Zoox asks before you walk in.

21 coding · 4 system design · 30 behavioral questions

Get Premium$49 a year · Instant access
Or start freeNo card.

Get their questions first.

What Zoox Tests in CodingHad your Zoox interview?How we research

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.