i have used kadane algorithm and test cases arn’t working
Test case not working
how to solve this and get test case work
hello @mittali
pls save ur code here->
and share its link with me , i will check and let u know ur mistakes
#include using namespace std; int maximumsubarraysum(int A[], int N){ int sum=0; int maxsum=0; for(int i=0; i<N; i++){ sum = sum+A[i]; if(sum<0){ sum=0; } maxsum = max(maxsum,sum); } return maxsum; } int main() { int T; int maxsum; cin>>T; for(int test = 0; test<T; test++){ int A[1000]; int N; cin>>N; for(int i=0; i<N; i++){ cin>>A[i]; } maxsum = maximumsubarraysum(A , N); cout<<maxsum<<endl; } return 0; }
go to this link -> https://ide.codingblocks.com/
paste ur code .
press ctrl + s and then save
a link will be generated in ur search bar(where u type for searching), share that link with me
Code is saved with file name
when u press save button a link will be generated in ur search bar like this->
share that link with me
check now->
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
