diff --git a/Kandane's_algorithum.cpp b/Kandane's_algorithum.cpp index 8fe28b4..b3eeee4 100644 --- a/Kandane's_algorithum.cpp +++ b/Kandane's_algorithum.cpp @@ -1,35 +1,35 @@ //Kandane's algorithum -// #include -// using namespace std; +#include +using namespace std; -// int main(){ -// int n; -// cin>>n; +int main(){ + int n; + cin>>n; -// int a[n]; + int a[n]; -// for(int i=0; i>a[i]; -// } + for(int i=0; i>a[i]; + } -// int max_sum = INT_MIN, current_sum=0; + int max_sum = INT_MIN, current_sum=0; -// for(int i=0; i max_sum){ -// max_sum = current_sum; -// } -// if(current_sum < 0){ -// current_sum = 0; -// } + if(current_sum > max_sum){ + max_sum = current_sum; + } + if(current_sum < 0){ + current_sum = 0; + } -// } + } -// cout<