The TransCompilator

Solved LeetCode program · 778 of 1,000

#1014 · Best Sightseeing Pair

Medium Array chunk-16.md

Original English source

The values is a list of 8, 1, 5, 2, and 6. The best is 0. The carry is item 0 of values.
For every spot from 1 to the last position of values.
The candidate is carry plus item spot of values minus spot. If candidate is more than best, set best to candidate. The offer is item spot of values plus spot. If offer is more than carry, set carry to offer.

Show best.

Open in Playground Browse all 1,000 problems

Expected stdout

11