Amazon Interview Question

Classic two-pointer / greedy array problem (maximise an objective over pairs of indices)