Skip to content

Commit c97441e

Browse files
authored
docs: add a description of the solution (doocs#651)
1 parent 70a84b4 commit c97441e

File tree

1 file changed

+6
-0
lines changed
  • lcof/面试题09. 用两个栈实现队列

1 file changed

+6
-0
lines changed

lcof/面试题09. 用两个栈实现队列/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929

3030
## 解法
3131

32+
- 两个栈,一个负责**输入**,一个负责**输出**
33+
- 执行输入时,只放入输入栈中;
34+
- 执行输出时,将输入栈的所有元素依次出栈,放入输出栈中;
35+
- 根据栈的特点,处于输入栈**栈底**的元素,在输出栈中便是**栈顶**
36+
- 只有输出栈中没有元素时才进行倒放,而非每一次。
37+
3238
<!-- tabs:start -->
3339

3440
### **Python3**

0 commit comments

Comments
 (0)