Resolve Winning Bidder Per Lot From Raw Bid Log
Last updated: November 29, 2026
Quick Overview
Given an unordered log of bids (lot id, bidder, amount, timestamp), each lot's end time, and a minimum bid increment, return the winning bidder and amount for every lot. A bid counts only if it arrives by the lot's end time and beats the standing high bid by at least the increment.
Whatnot
November 29, 20260
0
0 solved
Given an unordered log of bids (lot id, bidder, amount, timestamp), each lot's end time, and a minimum bid increment, return the winning bidder and amount for every lot. A bid counts only if it arrives by the lot's end time and beats the standing high bid by at least the increment.
Whatnot runs thousands of live auctions per day, and a common warm-up asks candidates to replay a bid log and decide who won. The interviewer checks whether you clarify ordering and tie rules before coding and keep the per-lot state in a hash map.
What the Interviewer Expects
- Ask how ties on timestamp are broken and whether the log is sorted
- Sort by timestamp with input order as the tiebreak
- Keep one hash map entry per lot holding the standing high bid
- Reject late bids and bids under the increment
- Return an explicit empty result for lots with no valid bids
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 process this as a live stream instead of a batch log?
- What changes if the increment depends on the current price tier?
- How would you support a buyer's maximum proxy bid?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: bids as (lot_id, bidder, amount, ts) in arbitrary order, end_times mapping each lot to its close time, and min_increment. A bid at exactly the end time counts. The first valid bid only ...
High-Level Design
Sort bid indices by (ts, index) so ties keep log order, then sweep once. A dictionary maps lot_id to the standing (bidder, amount). Each bid is checked against its lot's end time and the standin...