Push 5 characters ooops onto a stack. In how many different ways that we can pop these characters and still obtain ooops?
答案:5
如图 比如第一个 就是O1 push进去后,分两个情况,要么此时pop,要么此时push,然后依次讨论就行了。
(p\s肯定是o们都pop完了,然后依次先push后pop的,所以只需要考虑o1o2o3)
Push 5 characters ooops onto a stack. In how many different ways that we can pop these characters and still obtain ooops?
答案:5
如图 比如第一个 就是O1 push进去后,分两个情况,要么此时pop,要么此时push,然后依次讨论就行了。
(p\s肯定是o们都pop完了,然后依次先push后pop的,所以只需要考虑o1o2o3)