Skip to main content
2 of 4
added 6 characters in body
Ginger
  • 6k
  • 1
  • 21
  • 54

Python, 84 bytes

There's probably room for improvement here. Takes both the array and the length of the array, and returns a map.

lambda a,n:map(lambda u:sum(a[u-(2**len(bin(u+1).split("1")[-1])-1):u+1]),range(n))

Attempt This Online!

Ginger
  • 6k
  • 1
  • 21
  • 54