Skip to content

Commit b124bc6

Browse files
refactor 946
1 parent 0f21073 commit b124bc6

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

-24
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,6 @@
22

33
import java.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
public class _946 {
306
public static class Solution1 {
317
public boolean validateStackSequences(int[] pushed, int[] popped) {

0 commit comments

Comments
 (0)