Leetcode 0232. Implement Queue using Stacks

Posted on Sat 14 January 2023 in Leetcode • Tagged with stack, queue

Question Link : https://leetcode.com/problems/implement-queue-using-stacks/

Difficulty: Easy

Premium: False

Question

Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Implement the MyQueue class:

void push(int x) Pushes …


Continue reading