Finally getting back to some data-structures and algorithm questions. Starting off with some easy ones.
This problem was asked by Facebook.
Given a function f, and N return a debounced f of N milliseconds.
That is, as long as the debounced f continues to be invoked, f itself will not be called for N milliseconds.
This one was interesting as it introduced me 'debounce' and how it compares to throttling.
Problem Solution with Test Harness
Debouncing consolidates a series of sequential calls over a specified time interval into a single call. One invocation for events that fires multiple times, ensuring that the function is not invoked again for a specified time interval.
Throttling ensures that a function is invoked at maximum N number of times over a specified interval.
Interesting read on how this applied to Twitter.