Problem of the Day: 2 Stacks 1 Queue (update)

Sometimes the smallest thing messes up everything. I had a static marker on the head node so of course both stacks were the same! Oops. This caused the moving the items from one stack to the other problematic as they were the same stack. The other problem I ran into was I hadn’t considered the case of removing the last node from the head which caused some null pointer exceptions. All fixed now!

I re-used the head/node internal classes from POTD: Stacks & Queueus and remade the pop() and push() functions, then made the separate MyQueue class using two stacks as planned.