You are tasked with simulating basic operations on a queue of integers. Your function will receive an array of operation commands and should execute them in the order provided.
The operations will be provided as strings. The commands are:
-1
.1
if the queue is empty; otherwise, return 0
.Your function should return an array of outputs corresponding to the operations that produce a result (i.e. front
, size
, and empty
).
For the input:
enqueue 10
enqueue 20
front
dequeue
front
size
empty
The output should be:
[10, 20, 1, 0]
Today, on November 11 (Veterans Day), we honor those who serve. In the spirit of service, aim to write clean, well-documented code that can help others understand your logic.
Below is language-agnostic starter code for various languages to help you begin your solution.