Loading...
Is this your company?
Implement Stack using 2 queues
Anonymous
q1 ,q2 push (elem) q2.push(elem) while q1 not empty : q2.push(q1.pop()) q2, q1 = q2, q1 pop: q1.pop()
push(e) q1.push(e) pop() while q1.count >=2 q2.push(q1.pop()) q2, q1 = q2, q1 return q2.pop()
Check out your Company Bowl for anonymous work chats.
Get actionable career advice tailored to you by joining more bowls.
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalised job recommendations and updates by starting your searches.