Pergunta de entrevista da empresa Bloomberg

Write a function which returns true if is called more than 3 times in 3 seconds.

Resposta da entrevista

Sigiloso

10 de jun. de 2018

Create an array of 3 timestamps. When function is called compare if the last 3 saved times are older than 3 seconds... Also shift the array and save the current timestamp.