Hacker News new | ask | show | jobs
by jallen_dot_dev 1633 days ago
Instead of a linked list I would have:

allocated an array of size 10

an int i that increments on every call mod 10

Each successful call puts the current timestamp in array[i] and increments i. On each attempt to call, you check if array[i] is > 1 minute ago. This way you are only ever checking 1 array element instead of potentially deleting multiple list items and counting.