← Back to demo
Medium Coding Real-life challenges Write a function

The webhook arrived twice

30 pts
Reject repeated ids for ttl milliseconds after their last acceptance. events are ordered by non-decreasing integer time and have string ids. Accept the first occurrence and any occurrence where time − lastAccepted ≥ ttl. Rejections do not extend the window. Return a boolean per event. ttl is a positive integer and time comes from the input.