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

Commitb124bc6

Browse files
refactor 946
1 parent0f21073 commitb124bc6

File tree

1 file changed

+0
-24
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-24
lines changed

‎src/main/java/com/fishercoder/solutions/_946.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,6 @@
22

33
importjava.util.Stack;
44

5-
/**
6-
* 946. Validate Stack Sequences
7-
*
8-
* Given two sequences pushed and popped with distinct values,
9-
* return true if and only if this could have been the result of a sequence of push and pop operations on an initially empty stack.
10-
*
11-
* Example 1:
12-
* Input: pushed = [1,2,3,4,5], popped = [4,5,3,2,1]
13-
* Output: true
14-
* Explanation: We might do the following sequence:
15-
* push(1), push(2), push(3), push(4), pop() -> 4,
16-
* push(5), pop() -> 5, pop() -> 3, pop() -> 2, pop() -> 1
17-
*
18-
* Example 2:
19-
* Input: pushed = [1,2,3,4,5], popped = [4,3,5,1,2]
20-
* Output: false
21-
* Explanation: 1 cannot be popped before 2.
22-
*
23-
* Note:
24-
* 0 <= pushed.length == popped.length <= 1000
25-
* 0 <= pushed[i], popped[i] < 1000
26-
* pushed is a permutation of popped.
27-
* pushed and popped have distinct values.
28-
* */
295
publicclass_946 {
306
publicstaticclassSolution1 {
317
publicbooleanvalidateStackSequences(int[]pushed,int[]popped) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp