1
00:00:01,410 --> 00:00:02,969
Hi, everyone, welcome back.

2
00:00:03,090 --> 00:00:08,340
So in this video, we are going to write the code for this very simple problem and we discussed that

3
00:00:08,340 --> 00:00:10,500
we need one variable, make some some.

4
00:00:10,710 --> 00:00:12,510
Initially it was minus infinity.

5
00:00:13,230 --> 00:00:16,410
We need one variable current, some that will be initially zero.

6
00:00:16,710 --> 00:00:18,290
Then we need to iterate over that.

7
00:00:18,960 --> 00:00:25,110
And then what we need to do, we need to add the current element to the sum and then we need to update

8
00:00:25,110 --> 00:00:26,040
the maximum sum.

9
00:00:26,640 --> 00:00:32,720
So make some sum will be the maximum of the maximum sum that I have and the current sum.

10
00:00:33,330 --> 00:00:39,720
And one more important condition is I need to check if the current sum becomes to zero in the current

11
00:00:39,720 --> 00:00:46,650
sum becomes negative, then you need to make the current sum to be zero again so that this will be the

12
00:00:46,650 --> 00:00:47,480
complete code.

13
00:00:47,790 --> 00:00:50,680
So let's likely jump into writing the code.

14
00:00:52,140 --> 00:00:55,320
OK, so we need one variable maximum sum.

15
00:00:56,160 --> 00:00:58,770
Initially, this maximum is minus infinity.

16
00:00:58,770 --> 00:01:00,660
That is in the minimum.

17
00:01:02,700 --> 00:01:05,010
Next up, we have one variable and some.

18
00:01:06,600 --> 00:01:11,230
Which is initially zero, then you need to iterate over the area.

19
00:01:11,970 --> 00:01:16,740
I called zero, I left and you had editor size.

20
00:01:24,040 --> 00:01:32,410
And ready to hear you will add the element to the current, some so contemplative close to Iaat element

21
00:01:32,410 --> 00:01:38,260
of the ADDAE and we need to update the MAKSYM some, so make some.

22
00:01:38,260 --> 00:01:44,970
Some is close to the maximum of the current maximum sum and the current sum.

23
00:01:47,480 --> 00:01:57,200
And then I told you, if the current system becomes negative, then you need to make TransAm equals

24
00:01:57,200 --> 00:02:07,070
zero again, and finally you will return the maximum sum and that that will be the complete gold led

25
00:02:07,070 --> 00:02:09,370
first round our goal and then we will submit.

26
00:02:12,350 --> 00:02:12,770
Yep.

27
00:02:12,770 --> 00:02:15,570
So gold is passing the basic discuses.

28
00:02:16,160 --> 00:02:17,480
Now let's admit our gold.

29
00:02:20,510 --> 00:02:25,910
Yep, so basically our code is working and we have already discussed their time and the space, complexity

30
00:02:26,540 --> 00:02:33,230
and complexities big often and space complexities constant, you are creating few variables and you

31
00:02:33,230 --> 00:02:35,930
are trading already at a certain complexity big often.

32
00:02:36,090 --> 00:02:37,870
So that is all about this device.

33
00:02:37,880 --> 00:02:39,110
I will see you in the next one.

34
00:02:39,140 --> 00:02:39,680
Thank you.

