Ad
  • Default User Avatar

    range returns a single integer which is not iterable but enumerate returns an integer and the index

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    I think the clever thing of this solution is that you will only iterate arr to do the sum once. In the current top solution you iterate over it and do the sum len(arr) times making it O(n^2). Also, by using enumerate instead of range(len(arr)) you are already getting the element of the list to add it or substract it from the variables currently containing the sums.

  • Custom User Avatar

    I see that it happens with input: "one hundred" in function two_digit_parse in line auto word = group.front(), because group is empty.