Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Search in Rotated Sorted Array
Bookmark
Linear Scan
Modified Binary Search
Input
Example 1
Not found
No rotation
Single element
Target at end
Custom
nums
=
[4, 5, 6, 7, 0, 1, 2]
,
target
=
0
target = 0
0
1
2
3
4
5
6
4
5
6
7
0
1
2
target = 0
0
1
2
3
4
5
6
4
5
6
7
0
1
2
target = 0
0
1
2
3
4
5
6
4
5
6
7
0
1
2
i
target = 0
0
1
2
3
4
5
6
4
5
6
7
0
1
2
i
target = 0
0
1
2
3
4
5
6
4
5
6
7
0
1
2
i
target = 0
0
1
2
3
4
5
6
4
5
6
7
0
1
2
i
target = 0
0
1
2
3
4
5
6
4
5
6
7
0
1
2
i
target = 0
0
1
2
3
4
5
6
4
5
6
7
0
1
2
algo
master
.
io
Step:
Start: search for target 0 in the rotated array
0 / 6
Input
Example 1
Not found
No rotation
Single element
Target at end
Custom
nums
=
[4, 5, 6, 7, 0, 1, 2]
,
target
=
0
0 / 6
algo
master
.
io
Step:
Start: search for target 0 in the rotated array