Would it be more efficient to use just basic array?
“kristie”: [149836252, 149836586, 149836987]
We know that we allow 3 requests per minute.
- New request comes in. We calculate the current time minus time in the element with index = [array.length – 3]
- If it is less than a minute, we insert the time in the array, if more, deny the request
- To clean up space we delete all array elements with index = array.length - 4
In this case we do not need any fancy data structures.