Simulate Proxy Bidding to Find the Auction Winner and Price
Last updated: November 29, 2026
Quick Overview
Given an auction's starting price and a sequence of (bidder, maximum bid) submissions in cents, simulate eBay-style automatic bidding with a tiered increment table and return the winner and the final price they pay.
eBay
November 29, 20260
0
0 solved
Given an auction's starting price and a sequence of (bidder, maximum bid) submissions in cents, simulate eBay-style automatic bidding with a tiered increment table and return the winner and the final price they pay.
Proxy bidding is the core mechanic of eBay auctions: buyers enter a maximum and the system bids on their behalf only as much as needed to stay ahead. This onsite simulation tests whether you can turn a business rule into a clean state machine and get the tie and increment cases exactly right.
What the Interviewer Expects
- Keep only leader, leader's max and current price as state
- Price becomes the lower of the higher max and the lower max plus one increment
- Reject bids below the visible minimum next bid
- Earlier bid wins ties at the same max
- A leader raising their own max does not move the price
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you handle a reserve price the seller keeps hidden?
- Support bid retraction under eBay's rules and recompute the price.
- How would you make this safe when two bids for the same item arrive concurrently on different servers?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Money is integer cents to avoid float drift. The increment depends on the current price (5 cents under 5, and so on). A bid is valid if it is at least the current price plus one in...
High-Level Design
Only three values matter: leader, leader_max and price. For a new valid challenger:
- If their max beats the leader's, they lead, and the price is `min(challenger_max, leader_max + inc(leader_ma...