Round 1
Questions: Implement a FIFO Queue:
put(int)
: Adds item into queueget() int
: Removes and returns item in queue in FIFO order
Requirements:
- Fixed sized memory buffer
[]int
- No dynamic memory allocation (not allocating new memory or objects as part of
put
+get()
).
Follow up:
- Support for multiple thread access.
- Two queues which share this same fixed 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 fixed sized array can be dynamically adjusted based on each individual queue's usage.
- Minimize memory wastage
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.