LeetCode: Implement Queue using Stacks
Problem:
https://leetcode.com/problems/implement-queue-using-stacks/description/
Code:
class MyQueue:
def __init__(self):
self.in_stack=[]
self.out_stack=[]
def shift(self): # we use shift before pop/peek, we at core reverse...
is-power-of-two.hashnode.dev2 min read