| 1 | #include<bits/stdc++.h> |
| 2 | using namespace std; |
| 3 | int kadane(int arr[], int n){ |
| 4 | int current=0; |
| 5 | int largest=0; |
| 6 | for (int i = 0; i < n; ++i) |
| 7 | { |
| 8 | current+=arr[i]; |
| 9 | if(current<0){ |
| 10 | current=0; |
| 11 | } |
| 12 | largest= max(current,largest); |
| 13 | } |
| 14 | return largest; |
| 15 | } |
| 16 | void initial(){ |
| 17 | #ifndef ONLINE_JUDGE |
| 18 | freopen("input.txt", "r", stdin); |