Junior — Senior
Finding a continuous subsequence with a given sum
livecode
Task condition
An array of integers is given. It is required to find a non-empty subarray (a continuous segment) whose sum of elements equals the given value target, or to output that no such segment exists. Example: [9, -6, 5, 1, 4, -2], 10 → (2, 4)