Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Best Sightseeing Pair
Bookmark
Input
Classic
Increasing
Multiple Peaks
Complex
Custom
values
=
[8, 1, 5, 2, 6]
0
1
2
3
4
8
1
5
2
6
algo
master
.
io
Step:
Score = values[i] + values[j] + i - j. Split it: (values[i] + i) + (values[j] - j), and carry the best left part forward.
0 / 14
Input
Classic
Increasing
Multiple Peaks
Complex
Custom
values
=
[8, 1, 5, 2, 6]
0 / 14
0
1
2
3
4
8
1
5
2
6
algo
master
.
io
Step:
Score = values[i] + values[j] + i - j. Split it: (values[i] + i) + (values[j] - j), and carry the best left part forward.