Domanda di colloquio di Amazon

LeetCode Medium question about queues and summations