-
Given a stack which can keep M numbers at most. Push N numbers in the
order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if
a given sequence of numbers is a possible pop sequence of the stack.
For example, if M is 5 and N is 7, we can obtain 1, 2, 3, 4, 5, 6, 7
from the stack, but not 3, 2, 1, 7, 5, 6, 4.
输入描述:
Each input file contains one test case. For each case, the first line contains 3 numbers (all no more than 1000): M (the maximum capacity of the stack), N (the length ...
阅读题目
面试题
经典指数
-
-
-
-
-
-
-
-
-
设栈的输入序列是1,2,3,4,则()不可能是其出栈序列
1,2,4,3
2,1,3,4
1,4,3,2
4,3,1,2
3,2,1,4 ...
阅读题目
单选题
经典指数
扫描后移动端查看
相关标签
同类标签
|
微信公众号
|
|
欢迎加入,一起群聊
|