Skip to main content
approach
Source Link
Surculose Sputum
  • 8.4k
  • 1
  • 14
  • 40

Python 3.8, 41 bytes

lambda l:[t:=sum(l[:len(l)//2]),sum(l)-t] 

Try it online!

Straightforward solution. Takes in a list, and returns the list of left and right sum.


Interesting idea that didn't go anywhere :(

Python 3, 45 bytes

lambda l,t=1j:l>[]and l[-1]+t*f(l[-2::-1],-t) 

Try it online!

Returns a+bj where a, b is the right and left sum respectively.

Python 3.8, 41 bytes

lambda l:[t:=sum(l[:len(l)//2]),sum(l)-t] 

Try it online!

Straightforward solution. Takes in a list, and returns the list of left and right sum.

Python 3.8, 41 bytes

lambda l:[t:=sum(l[:len(l)//2]),sum(l)-t] 

Try it online!

Straightforward solution. Takes in a list, and returns the list of left and right sum.


Interesting idea that didn't go anywhere :(

Python 3, 45 bytes

lambda l,t=1j:l>[]and l[-1]+t*f(l[-2::-1],-t) 

Try it online!

Returns a+bj where a, b is the right and left sum respectively.

Source Link
Surculose Sputum
  • 8.4k
  • 1
  • 14
  • 40

Python 3.8, 41 bytes

lambda l:[t:=sum(l[:len(l)//2]),sum(l)-t] 

Try it online!

Straightforward solution. Takes in a list, and returns the list of left and right sum.