Notification Deduplication Window
Updated
Problem statement
A notification service receives a finite batch of arrivals. The arrays notificationIds and timestamps describe the same n arrivals in order. Each timestamp is measured in seconds, and the timestamps are nondecreasing.
Process each arrival using a 600-second deduplication window:
- An arrival is a duplicate when the same notification ID was seen less than
600seconds earlier. - An arrival exactly
600seconds after the previous sighting is not a duplicate. - Every arrival becomes the new last sighting for its ID, including an arrival that is suppressed as a duplicate.
Return a boolean array in arrival order. Return true for an accepted notification and false for a suppressed duplicate.
Memory requirement
Discard identifiers as soon as their most recent sighting leaves the active window. The retained state must remain proportional to the identifiers still active in the window rather than the total number of processed arrivals.
Function
deduplicateNotifications(notificationIds: String[], timestamps: int[]) → boolean[]Examples
Example 1
notificationIds = ["A","B","A","A"]timestamps = [0,100,599,1199]return = [true,true,false,true]The arrival of A at 599 is suppressed because it is 599 seconds after the first A. That duplicate refreshes the last-seen time to 599. The final A arrives exactly 600 seconds later, so it is accepted.
Example 2
notificationIds = ["X","X","Y","X","Y"]timestamps = [42,42,42,641,642]return = [true,false,true,false,true]The second X is a duplicate at the same timestamp. The X at 641 is still inside its window, while the Y at 642 is exactly 600 seconds after its previous sighting and is accepted.
Example 3
notificationIds = ["N","N","N","N"]timestamps = [10,609,1208,1808]return = [true,false,false,true]Each suppressed arrival refreshes N, so the arrivals at 609 and 1208 remain duplicates. The final arrival is exactly 600 seconds after the refreshed time 1208 and is accepted.
Constraints
1 <= n <= 2 * 10^5notificationIds.length == timestamps.length == n- Each value in
notificationIdsis a non-empty opaque identifier string. 0 <= timestamps[i] <= 10^9timestamps[i] <= timestamps[i + 1]for every validi.- Timestamps are measured in whole seconds.
More Goldman Sachs Onsite Interview questions
- Knight Probability in ChessboardONSITE INTERVIEW · Seen Nov 2026
- Best Average Student ScorePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Meeting RoomsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Meeting Rooms Without a Sweep LineONSITE INTERVIEW · Seen Oct 2026
- First Non-Repeating CharacterPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Root of the Largest TreePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Dungeon HealthONSITE INTERVIEW · Seen Sep 2026
- Insert, Delete, And Get Random In Constant TimeONSITE INTERVIEW · Seen Sep 2026
- Least Recently Used CacheONSITE INTERVIEW · Seen Sep 2026
- Staircase Search In A Sorted MatrixONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Design Authentication ManagerOracle · ONSITE INTERVIEWOracle interview questions
- Thread-Safe Task Storage and Worker DispatchNuro · ONSITE INTERVIEWNuro interview questions
- Helpdesk Ticket ProcessingThe Walt Disney Company · ONSITE INTERVIEWThe Walt Disney Company interview questions
- Execute Tasks by PrioritySnowflake · ONSITE INTERVIEWSnowflake interview questions
- Priority Job Scheduler with CooldownsGoogle · ONSITE INTERVIEWGoogle interview questions
- 15-Minute Chat Session TrackerOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- LRU Cache with TTLAutodesk · ONSITE INTERVIEWAutodesk interview questions
- Tiered Expiring Item StoreHudson River Trading · PHONE SCREEN · ONSITE INTERVIEWHudson River Trading interview questions
- Limit Order Book Matching EngineCitadel · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
- Expiring Key SetAmazon · ONSITE INTERVIEW