Question

Consider a `Stack` data structure implemented with `push` and `pop` operations. What is the final state of the stack after the following sequence of operations?    ```     Stack s;     s.push(10);     s.push(20);     s.pop();     s.push(30);     s.push(40);     s.pop();     ```

A [10,20,30,40](bottom to top)
B [10,20,30](bottom to top)
C [10,30](bottom to top)
D [10,20,30](bottom to top)
Practice Next

Hey! Ask a query