Pairwise Summation

Anyone have insight how to solve this problem?
https://www.hackerearth.com/challenges/competitive/pycon-2020/algorithm/jumbo-and-array-1-69b5c314-2b740e3b/
I got TLE and I suspect I need closed-form (O(1)) solution for the summation.

image
image
image

Comments (0)