An alert manager should not send a new page for every evaluation of the same active alert. It groups equivalent alerts by fingerprint, suppresses repeats for a configured interval, and forgets the active incident after resolution.
Design an AlertNotificationManager class:
AlertNotificationManager() creates a stateless manager.boolean[] notificationStates(String[] fingerprints, int[] states, int[] timestamps, int repeatInterval) returns whether each event sends a notification.
Arrays are aligned and processed chronologically. states[i] == 1 means firing; states[i] == 0 means resolved.
- A firing event for an inactive fingerprint notifies immediately and activates it.
- An active fingerprint notifies again only when at least
repeatInterval time has passed since its last notification. - A repeated notification resets that fingerprint's repeat timer.
- Resolution never notifies and clears the fingerprint. Its next firing event is new.
Example 1:
Input:
Output:
Explanation: The active alert repeats at timestamp 10. Resolution at 12 clears it, so firing at 13 produces a fresh notification.
Example 2:
Input:
Output:
Explanation: Each fingerprint owns its timer. Disk's second event occurs 11 units after its notification; CPU's occurs only 5 units later.
Constraints
1 <= fingerprints.length == states.length == timestamps.length <= 10^5- Fingerprints are non-empty lowercase strings.
states[i] is 0 or 1.0 <= timestamps[i] <= 10^9, and timestamps are nondecreasing.0 <= repeatInterval <= 10^9- Return one decision per event in input order.
- At most
100 calls are made to notificationStates.