Company: Quadeye_17sep
Difficulty: medium
Stay Positive Problem Description You are given an array of integers arr of length n . You choose a starting value x , which must be a positive integer ( x >= 1 ). Starting from x , a running sum is formed by adding the elements of arr to it one at a time, from left to right: after the first addition the running sum is x + arr[0] , after the second addition it is x + arr[0] + arr[1] , and so on, until all n elements have been added. The running sum must be at least 1 after every addition . Find the minimum positive integer x for which this holds. Complete the function minStart(arr) , which returns this minimum starting value. Input Format Read from standard input. The first line contains an integer n , the number of elements in arr . Each of the next n lines contains one integer arr[i] . Output Format Print a single integer: the minimum positive starting value x . Constraints 1 <= n <= 2 * 10^4 (inferred -- the source states 1 <= n <= 10^5 ; at that size the input is up