Problem · Hash Table
Service Timeout Detection
Learn this problemProblem statement
Heartbeat events are recorded with a timestamp and a service identifier. A service times out if the gap between any two consecutive heartbeats for that service is strictly greater than a given threshold.
Return all service identifiers that time out at least once, sorted lexicographically.
Function
detectTimedOutServices(timestamps: int[], serviceIds: String[], threshold: int) → String[]Examples
Example 1
timestamps = [10, 20, 80, 10, 65]serviceIds = ["svc1", "svc1", "svc1", "svc2", "svc2"]threshold = 30return = ["svc1", "svc2"]svc1 has a 60-second gap between heartbeats at 20 and 80, and svc2 has a 55-second gap between 10 and 65. Both exceed the threshold.
Constraints
1 <= n <= 2 * 10^51 <= timestamps[i] <= 10^90 <= threshold <= 10^9
More IBM problems
- Parent Process NumberOA · Seen Jul 2026
- Request Retry CountOA · Seen Jul 2026
- Count Strictly Increasing Subsequences of Length 3OA · Seen Jul 2026
- Maximum Requests in a Time WindowOA · Seen Jul 2026
- Query Type Frequency WindowOA · Seen Jul 2026
- Minimum Number of Non-Empty Disjoint SegmentsOA · Seen Jul 2026
- Spam Text ClassificationOA · Seen Jul 2026
- Count Ideal NumbersOA · Seen Jun 2026