Is this your company?
given an array , while parsing it following operations were performed at each element on an initially empty stack and queue: - empty the contents of the stack into the queue - push the current element of the array on the the stack - empty the queue and push the element onto the stack the stack should be returned after parsing the array completely.
Anonymous
Since we are putting the elements of the stack onto the queue and the taking the back , we're effectively reversing the stack at each iteration hence the ends to which the element gets attached depends only on the parity of the index.
Check out your Company Bowl for anonymous work chats.