Auction.com interview question

simple ds and algo