Solution Review: Implement Queue using Stack - Data Structures for Coding

Hi Team,
In Optimizing both enqueue() and dequeue() solution there might be a problem as if we don’t fill on the stack1 after pop operation, it might end up storing more values than the maxSize, as now total capacity available will become stack1.maxSize + stack2.currentsize.

We can’t use the same enqueue metho unless we have the currentSize of bothe the stacks.

Please correct me if I am wrong here.