Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5d31a9

Browse files
add 0946-validate-stack-sequences.py
1 parent6e1801d commitb5d31a9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
classSolution(object):
2+
defvalidateStackSequences(self,pushed,popped):
3+
i=0
4+
stack= []
5+
forninpushed:
6+
stack.append(n)
7+
whilei<len(popped)andstackandpopped[i]==stack[-1]:
8+
stack.pop()
9+
i+=1
10+
11+
returnnotstack
12+
13+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp