Google Phone Screen Round 28th August 2025
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-08-28Added By Anonymous
Source: Link
Company: Google
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: 2025
Original Post Content:
You're tasked with designing a system that handles a real-time stream of item listings. Each listing consists of:
- seller_id
- price (ranging from ₹0.01 to ₹100)
- time (the system timestamp at which the item is listed)
Each seller can list the same item multiple times. Your system should support the following two operations:
- insertEntry(seller_id, price, time): This method is called whenever a seller lists a new item.
- getSellerId(): This method returns the seller_id of the listing with the lowest price and removes it from the system (meaning it is sold). In case of a tie (i.e., multiple listings with the same lowest price), return the one with the earliest timestamp.
1. What should be the datatype of the variables seller_id, price, time? You can consider time as epoch time.
2. What data structure(s) would you use to efficiently support these operations?
3. What would be the time complexity of each method?