Maximise sum

Company: Google_IITR

Difficulty: medium