Leetcode 3508. Implement Router
Design a Router that stores up to memoryLimit packets in FIFO order, rejects duplicates (same source, destination, timestamp), evicts the oldest packet when full, and forwards/removes packets in FIFO order. Support getCount(destination, startTime, endTime) to count currently stored packets for a destination in a timestamp range; note that addPacket calls come in non-decreasing timestamp order, enabling efficient per-destination range counting.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.