For this Question: Tono and Solo are one of the best programmers on the planet. Solo knows how to solve the problem on maximum subarray sum using the Kadane algorithm (don't you?). Now, Tono gives Solo a trickier problem to solve. In this problem, Solo can choose any non- empty subarray, the value of the subarray will be the <b>(sum of all the elements of the subarray - largest element of the subarray)</b>. Can you find the maximum value of any subarray?The first line of the input contains a single integer N, the size of the array.
The second line of the input contains N elements A[1], A[2],. , A[N].

Constraints
1 <= N <= 100000
-30 <= A[i] <= 30Output a single integer, the value of the subarray having maximum value.Sample Input
7
5 2 5 3 -30 -30 6 

Sample Output
10

Explanation: Solo chooses the subarray [5, 2, 5, 3]. The value of the subarray is 10.

Sample Input
3
-10 6 -15

Sample Output
0, I have written this Solution Code: def maxSumTill(arr,n):
    currSum = 0
    maxSum = 0
    maxEle = 0
    maxi = 0
    for i in range(1,n+1):
        maxEle = max(maxEle,arr[i])
        currSum += arr[i]
        if currSum-maxEle < 0:
            currSum = 0
            maxEle =0
        if currSum-maxEle > maxSum:
            maxi = currSum - maxEle
            maxSum = maxi
    return maxi

def maxOfSum(arr,n):
    currSum = 0
    maxSum = 0
    maxEle = 0
    for i in range(1,n+1):
        currSum += arr[i]
        if currSum < 0:
            currSum = 0
        if currSum > maxSum:
            maxSum = currSum
            maxEle = max(maxEle, arr[i])
    return maxSum - maxEle


n = int(input())
arr = list(map(int,input().split()))
arr = [0]+arr
val1 = maxSumTill(arr,n)
val2 = maxOfSum(arr,n)
print(max(val1,val2))














  



, In this Programming Language: Python, Now tell me if this Code is compilable or not?