阅读背景:

数据结构练习 02-线性结构3. Pop Sequence (25)

来源:互联网 

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.Given a stack which can keep M numbers at most.




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: