Rubrik | Systems Coding | Senior Software Engineer

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-01-15Added By Anonymous
Source: Link

Implement a FIFO Queue:

•put(int): Adds item into queue.
•get() int: Removes and returns item in queue in FIFO order.


Requirements:

•Fix sized memory buffer []int.
•No dynamic memory allocation (not allocating new memory or objects as part of put + get()).


Follow up:

1.Support for multiple thread access.
2.Two queues which share this same fix sized memory buffer.
•Need to support FIFO ordering for each queue individually.
•The size of this int[] (100MB - > 1GB+).
•We want to make sure usage of this fix sized array can be dynamically adjusted based on each indiv. queue's usage.
•Minimize memory wastage.


Comments