Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

commit one #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/maxsumsubaaray.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include<climits>

using namespace std;


int main(){
int n;
printf("Enter the array size");
scanf("%d",&n);
int arr[n];
for(int i=0;i<n;i++){
scanf("%d",arr[i]);
}
printf("%d",maxSubArray(arr));
}
int maxSubArray(int *A) {
int max_sum = INT_MIN,sum = 0,i;
for(i=0;i<A.size();i++)
{
sum+=A[i];
if(max_sum<sum)
max_sum = sum;
if(sum<0)
sum = 0;
}
return max_sum;
}
Empty file added src/nextPrime.js
Empty file.