MJay

232. Implement Queue using Stacks 본문

Programming/LeetCode

232. Implement Queue using Stacks

MJSon 2020. 9. 15. 23:44

Stack
Queue

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 인가보다.

 

 

 

'Programming > LeetCode' 카테고리의 다른 글

Single Number 136  (0) 2020.04.06
344  (0) 2020.04.06
1135  (0) 2019.11.06
1064  (0) 2019.11.03
647  (0) 2019.11.03