Maximum _subarray

I solve the problem but i am not able to initialize the array by the constarit.plzz tellme how to solve the problem under the constraint

hi @np354813 please share your code by saving it on cb ide

plzz fast .i am not able to get full score.

@np354813 share your code fast and then I’ll also be able to help you fast

mam i am already share the code at cb ide

@np354813 where have you shared it??

mam u getting my code or not

@np354813 where did you share it? I dont have any code on messages or here. Please share the link here.

#include<bits/stdc++.h>

using namespace std;

#define ll long long

ll maxsubarray(ll arr[],ll n)

{

ll max_so_far=0;

ll  curr_sum=0;

for(ll i=0;i<n;i++)

{

    curr_sum+=arr[i];

    if(curr_sum<0)

    {

        curr_sum=0;

    }

    max_so_far=max(curr_sum,max_so_far);

}

return max_so_far;

}

int main()

{

int t;

cin>>t;

while(t--)

{

    ll  n;

    cin>>n;

    ll arr[ 100000000];

    for(ll  i=0;i<n;i++)

    {

        cin>>arr[i];

    }

    cout<<maxsubarray(arr,n)<<endl;

    

}

return 0;

}

@np354813
go to ide.codingblocks.com save your code there and then share the link generated.

how to share mam??before it i was not share the code such way.i am always sharing the code in collabaration mode.reply plzz help ur junior

@np354813 follow these steps
go to ide.codingblocks.com
paste your code in the ide
go to file>save
copy the link generated
share that link here

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.