FastPrepAuction Lot Bid Summary
Problems/Auction Lot Bid Summary

Auction Lot Bid Summary

HackerRank logoHackerRank● MediumFULLTIMEOA

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: Reported in this company's online assessment for a forward deployed engineer role. One task was a SQL query over auction lots and their bids. For each lot, the query returns how many bids it has, its current price and who bid last. Lots with no bids must still be listed.

The report does not give the tables, what the current price means, how to break a tie for the latest bid, or the row order. Here, there is a lots table and a bids table. The current price is the highest bid, or the starting price when there are no bids. The latest bidder goes by bid time, and the larger bid ID wins a tie. A lot with no bids shows 0 bids and no latest bidder. Rows are sorted by lot ID.

Our version is about 75% the same as the reported question.

An online auction sells items in lots. lots has one row per lot, with its title and the price the bidding starts at. bids has one row per bid, with the lot it is for, the bidder's username, the amount, and the time it was placed.

For every lot, return lot_id, title, bid_count, current_price and latest_bidder, sorted by lot_id from smallest to largest.

  • bid_count is the number of bids on the lot. When one bidder bids several times, every bid counts.
  • current_price is the highest bid amount on the lot. A lot with no bids keeps its starting_price.
  • latest_bidder is the bidder of the lot's most recent bid, the one with the latest bid_time. When several bids share that time, take the one with the largest bid_id. A lot with no bids gets NULL.
  • Every lot appears exactly once, including lots with no bids, which have a bid_count of 0.
  • A later bid can be lower than an earlier one, so the latest bidder is not always the bidder with the highest amount.

Table schema

MySQLPostgreSQLPandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

lots

One row per auction lot.

ColumnTypeNullableDescription
lot_idPKIntegerNoUnique lot ID.
titleTextNoLot title. Two lots can share a title.
starting_priceIntegerNoPrice the bidding starts at.

bids

One row per bid placed on a lot.

ColumnTypeNullableDescription
bid_idPKIntegerNoUnique bid ID. IDs do not follow time order.
lot_idIntegerNoThe lot the bid is for.
bidderTextNoUsername of the person who placed the bid.
amountIntegerNoBid amount.
bid_timeTimestampNoWhen the bid was placed, to the second.

Foreign key: lot_id → lots(lot_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
lot_idIntegerNo—
titleTextNo—
bid_countIntegerNo—
current_priceIntegerNo—
latest_bidderTextYes—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • lots has between 1 and 200 rows, and bids has between 0 and 1500 rows.
  • lot_id and bid_id are unique integers between 1 and 10^9.
  • Every bids.lot_id matches a row in lots.
  • title has between 1 and 60 characters, and bidder has between 1 and 30 characters.
  • starting_price and amount are integers between 1 and 10^6, and every bid's amount is at least its lot's starting_price.
  • bid_time is between 2020-01-01 00:00:00 and 2030-12-31 23:59:59, in whole seconds.

More HackerRank interview questions

  • REST API: Country CodesOA · Seen Nov 2026
  • Classify Password StrengthOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Longest Equal Binary SubarrayOA · Seen Dec 2025
  • Longest Equal Binary Subarray After One FlipOA · Seen Dec 2025
  • Longest Prefix-Valid Binary SubarrayOA · Seen May 2025
  • Check Permutation Divisible by EightONSITE INTERVIEW · Seen Mar 2026
  • Ball Passing at Time KPHONE SCREEN · Seen Dec 2025

Similar questions at other companies

  • Bond Holders Above the Cash Flow ThresholdBirla Pivot · OA
  • Prepare Taxi Driver Classification DataBoston Consulting Group · OABoston Consulting Group interview questions
  • Find the Dominant SellerSquadStack.ai · OA
  • Track the Book and Mark Final PnLMillennium · OAMillennium interview questions
  • Market Share Ticker with ImbalanceWolverine Trading · OAWolverine Trading interview questions
  • Overloaded Game Account InventoriesWells Fargo · OAWells Fargo interview questions
  • Transaction Totals and Ranked Failure ReasonsIntuit · OAIntuit interview questions
  • Employees Joined per MonthOdoo · OAOdoo interview questions
  • Bond Haircut by Ratings and MaturityJane Street · OAJane Street interview questions
  • Customer Order FeesAdobe · OAAdobe interview questions
All HackerRank interview questionsSee HackerRank hiring insights