Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Search a 2D Matrix II
Bookmark
Brute Force
Binary Search per Row
Staircase Search
Input
Example 1 (found)
Example 2 (not found)
3x3 matrix (found)
Top-left corner
Not found (larger than all)
Custom
matrix
=
[[1,4,7,11],[2,5,8,12],[3,6,9,16],[10,13,14,17]]
,
target
=
5
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
i,j
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
i,j
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
i,j
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
i,j
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
i,j
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
i,j
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
1
4
7
11
2
5
8
12
3
6
9
16
10
13
14
17
algo
master
.
io
Step:
Start: brute-force scan every cell for target 5
0 / 9
Input
Example 1 (found)
Example 2 (not found)
3x3 matrix (found)
Top-left corner
Not found (larger than all)
Custom
matrix
=
[[1,4,7,11],[2,5,8,12],[3,6,9,16],[10,13,14,17]]
,
target
=
5
0 / 9
algo
master
.
io
Step:
Start: brute-force scan every cell for target 5