Ad
  • Default User Avatar

    Works, but not 100% correct. The number at the current index is always added to the left and right sum. By definition, the number at the current index should not be taken into account:

    "...
    Last one:
    You are given the array {20,10,-80,10,10,15,35}
    At index 0 the left side is {}
    The right side is {10,-80,10,10,15,35}
    They both are equal to 0 when added. (Empty arrays are equal to 0 in this problem)
    Index 0 is the place where the left side and right side are equal.
    ...
    "

    Here, left and right sum are 20 at index 0.