Company: Quadeye_17sep
Difficulty: medium
Stay Positive Problem Description Given an array of integers and a non-zero positive value x that you choose, a running sum is calculated by adding each element of the array to x consecutively. Determine the minimum value of x such that the running sum is at least 1 after every addition. Complete the minStart function in the editor with the following parameter(s): int arr[n] : an array of integers to sum Returns: long : the minimum initial value Examples Example 1: Input: arr = [-4, 3, 2, 1] Output: 5 Explanation: Let starting value x = 5 . Running sums: 5 + (-4) = 1 , 1 + 3 = 4 , 4 + 2 = 6 , 6 + 1 = 7 . All running sums are >= 1 . There is no value smaller than 5 that satisfies the condition. Example 2: Input: arr = [-3, -5, -2, 1] Output: 4 Explanation: If the starting value is 4, running sums are [7, 1, 6, 4, 5] . This is the minimum starting value. Example 3: Input: arr = [5] Output: 1 Explanation: The starting value of x is 1. Running sum: 1 + 5 = 6 . All running sums are >=