Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
132 Pattern
Bookmark
Brute Force
Precomputed Min
Fenwick Tree
Monotonic Stack
Input
Example 1
Example 2
Example 3
Custom
nums
=
[3, 1, 4, 2]
3
0
1
1
4
2
2
3
3
0
1
1
4
2
2
3
3
0
1
1
4
2
2
3
3
0
1
1
4
2
2
3
i
1
j
3
3
0
1
1
4
2
2
3
i
1
j
3
k
2
3
<
4
<
1
?
3
0
1
1
4
2
2
3
i
1
j
3
k
2
3
<
2
<
1
?
3
0
1
1
4
2
2
3
i
1
j
3
k
2
3
<
2
<
4
?
3
0
1
1
4
2
2
3
i
1
j
3
3
0
1
1
4
2
2
3
i
1
3
0
1
1
4
2
2
3
i
1
j
3
k
2
1
<
2
<
4
✓ 132 pattern
3
0
1
1
4
2
2
3
return true
(132 pattern found)
algo
master
.
io
Step:
Brute force: test every triple i < j < k for nums[i] < nums[k] < nums[j].
0 / 12
Input
Example 1
Example 2
Example 3
Custom
nums
=
[3, 1, 4, 2]
0 / 12
algo
master
.
io
Step:
Brute force: test every triple i < j < k for nums[i] < nums[k] < nums[j].