Add a last-moment bidding strategy and a Dutch auction to an existing auction system
Company: Whatnot
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Onsite
In a two-hour AI-assisted coding round you receive the starter code of an existing auction system and must add two features to it:
1. **A new kind of participant.** Participants bid according to a strategy; add a new strategy, for example a bidder who stays silent and bids only at the last moment.
2. **A new auction format**, for example a Dutch auction.
You have about 45 minutes to implement both features with an AI coding assistant, including the test cases. The last half hour is a walkthrough of your code with the interviewer, who may ask for further changes to be written live.
The report does not include the starter code. For practice, assume it contains an ascending auction that accepts bids while it is open and awards the item to the highest bidder when it closes, bidder objects whose strategy is asked on every tick of a simulated clock whether to bid and how much, and a driver that advances the clock. Map these names to the real code when you have it.
### Clarifying Questions
- May I change existing interfaces, or must both features plug into them unchanged?
- Is time a discrete simulated tick or wall-clock time, and how does a strategy learn when the auction closes?
- Must a bid beat the current highest bid by a minimum increment, and is there an opening price?
- How should a strategy written for one auction format behave in the other?
### Part 1 — The last-moment bidder
Implement a strategy that does not bid until the auction is about to close, then bids just enough to take the lead, without exceeding its own maximum.
```hint Define the last moment in ticks
Work out what the strategy can observe about the remaining time, which tick is the final one on which a bid is still accepted, and what it should do if it already leads.
```
#### Clarifying Questions for this Part
- Does a late bid extend the closing time, or is the close fixed?
- If two participants bid the same amount on the same tick, who leads?
#### What This Part Should Cover
- How the strategy fits the existing strategy interface without changes to the other strategies
- The exact timing window and the bid amount, bounded by the bidder's maximum and the increment
- Edge cases: no bids yet, already leading, budget too low, the tick after closing
### Part 2 — The Dutch auction
Add a Dutch auction format. Assume the asking price starts at a given value and drops by a fixed step at each tick; the first participant who accepts the current price wins the item at that price; if nobody accepts by the floor price, the item goes unsold.
```hint Nobody outbids anybody
In a descending auction no one raises another participant's bid; think about which single decision each participant must make at each price, and how strategies written for the ascending auction can make it.
```
#### Clarifying Questions for this Part
- One item or several identical units?
- What are the starting price, the step and the floor, and must the floor itself be offered?
#### What This Part Should Cover
- The price schedule and when the auction ends, sold or unsold
- How existing and new strategies decide whether to accept a price
- A deterministic rule when several participants accept on the same tick
- Validation of the configuration (step, floor, starting price)
### Part 3 — Tests and the walkthrough
Write the tests for both features and prepare the half-hour walkthrough: what you changed, why, and how the tests show that it works.
```hint Test where behavior flips
List the ticks and prices at which each feature's behavior changes, and write a test at each of those boundaries before asking the assistant for more.
```
#### What This Part Should Cover
- Deterministic tests driven by the simulated clock, one per boundary
- How the code and tests the assistant produced were reviewed and verified
- A walkthrough that explains the code logic and the edge cases covered
- A change that stays proportionate to the two features
### What a Strong Answer Covers
- Reads the starter code first and extends it at its existing extension points
- Gets both features working before polishing or generalizing, with a design no larger than the task needs
- Handles edge cases explicitly and shows each one with a test
- Uses the AI assistant for speed while checking, and being able to explain, every line it produced
- Leaves time to present clearly and to implement follow-ups live
### Follow-up Questions
- Two last-moment bidders bid the same amount on the final tick. Who wins in your code, and where is that decided?
- Add a soft close that extends the auction whenever a bid arrives near the end. What happens to your last-moment strategy and its tests?
- Make the Dutch auction sell several identical units. How do you price and allocate them?
- How would you stop a bidder from committing more than its budget across several auctions running at once?
Overview: Extend an existing auction system with a bidder that waits to bid at the last moment and a Dutch auction format, using an AI coding assistant and writing tests, then walk the interviewer through the code. It tests fitting features into starter code, edge cases around closing times and ties, and keeping the change proportionate.
Read the full Whatnot Software Engineer interview experience this question came from