Hi, everyone, welcome back.
So in this video, we are going to write the code for this very simple problem and we discussed that
we need one variable, make some some.
Initially it was minus infinity.
We need one variable current, some that will be initially zero.
Then we need to iterate over that.
And then what we need to do, we need to add the current element to the sum and then we need to update
the maximum sum.
So make some sum will be the maximum of the maximum sum that I have and the current sum.
And one more important condition is I need to check if the current sum becomes to zero in the current
sum becomes negative, then you need to make the current sum to be zero again so that this will be the
complete code.
So let's likely jump into writing the code.
OK, so we need one variable maximum sum.
Initially, this maximum is minus infinity.
That is in the minimum.
Next up, we have one variable and some.
Which is initially zero, then you need to iterate over the area.
I called zero, I left and you had editor size.
And ready to hear you will add the element to the current, some so contemplative close to Iaat element
of the ADDAE and we need to update the MAKSYM some, so make some.
Some is close to the maximum of the current maximum sum and the current sum.
And then I told you, if the current system becomes negative, then you need to make TransAm equals
zero again, and finally you will return the maximum sum and that that will be the complete gold led
first round our goal and then we will submit.
Yep.
So gold is passing the basic discuses.
Now let's admit our gold.
Yep, so basically our code is working and we have already discussed their time and the space, complexity
and complexities big often and space complexities constant, you are creating few variables and you
are trading already at a certain complexity big often.
So that is all about this device.
I will see you in the next one.
Thank you.