Programming/LeetCode
232. Implement Queue using Stacks
MJSon
2020. 9. 15. 23:44



Do you know when we should use two stacks to implement a queue?
I was asked in an internship interview with a company two years ago.
The application for this implementation is to separate read & write of a queue in multi-processing. One of the stacks is for reading, and another is to write. They only interfere with each other when the former one is full or the latter is empty.
Python에서는 Stack이 List 인가보다.
