Ignore Sections
Write a function that returns a list of numbers from an array, excluding any sections that start with a 1 and extend to the next 0. Also, compute the sum of the numbers in the resulting list. Ignore any numbers from a 1 that is followed by another 1 until a 0 is found.
Function Signature
def ignore10(arr):
Parameters
arr (List[int]): An array of integers from which sections will be ignored as described.
Returns
Tuple[List[int], int]: A tuple containing the modified array and the sum of its elements.
1Example 1
The numbers between the first 1 and the next 0 (inclusive) are ignored, which are 1, 7, 0. The subsequent 1 is not followed by a 0, hence it and the numbers following it are included.
2Example 2
There is no 1 followed by 0 that encloses numbers to ignore. All numbers are included.
3Example 3
The sequence starting with 1 at index 3 ends with 0 at index 9. All numbers between these indices are ignored.
4Example 4
The numbers between the first 1 and the next 0 (inclusive) are ignored, which includes all numbers from the first 1 to the 0.
Constraints
Limits and guarantees your solution can rely on.
1 <= arr.length <= 10^5-10^9 <= arr[i] <= 10^9