Today, we're simulating a basic queue. Your task is to write a function that processes a list of operations and outputs the final state of the queue. The operations are provided as strings. The possible operations are:
enqueue X
: Add the integer X to the back of the queue.dequeue
: Remove an element from the front of the queue. If the queue is empty, do nothing.An array (or list) of strings, where each string is one of the operations described above.
Return an array (or list) representing the state of the queue after processing all operations. The front of the queue should be at the beginning of the array.
For the input: ['enqueue 5', 'enqueue 3', 'dequeue', 'enqueue 7']
, the final state of the queue should be [3, 7]
.
Fun Fact: December 2nd is celebrated in some cultures with unique local traditions. Enjoy this problem as you kick off the festive end-of-year spirit!