Qualcomm Interview Question

Implement queue using two stack. How to design a system to avoid deadlock.