Confluent·Software Engineer·Technical Phone Screen
- Design a random queue: a FIFO queue where dequeue returns a random element from the current contents instead of the front element.
- How would you determine whether two random queues are equal?
- What multithreading issues come up with a random queue, particularly around concurrent enqueue and dequeue operations and maintaining consistency during an equality check?
- If the queue is stored using variable-length run-length encoding, how would you compare two such encoded queues for equality?
“My first instinct was to reach for an array and swap the chosen element to the front before removing it, which works but I fumbled explaining the time complexity clearly.”