1
00:00:01,859 --> 00:00:02,550
Hi, everyone.

2
00:00:02,580 --> 00:00:07,470
So in today's video, we are going to solve this question and find the midpoint of a long list.

3
00:00:07,830 --> 00:00:09,410
OK, so one link left.

4
00:00:09,990 --> 00:00:12,090
Let's say the linked list is of Aadland.

5
00:00:12,750 --> 00:00:15,930
So one, two and three, four and five.

6
00:00:17,990 --> 00:00:20,560
OK, so what is the midpoint?

7
00:00:20,600 --> 00:00:23,240
So my point is basically this node three.

8
00:00:23,450 --> 00:00:24,020
OK, so what?

9
00:00:24,020 --> 00:00:24,650
We have to return.

10
00:00:24,650 --> 00:00:25,490
We have to return.

11
00:00:25,640 --> 00:00:27,500
The return of the function will be node star.

12
00:00:27,500 --> 00:00:31,190
And let's say the name of the function is find out what it will take.

13
00:00:31,220 --> 00:00:32,820
So it will take had input.

14
00:00:33,980 --> 00:00:35,540
OK, so we have to write the code.

15
00:00:36,350 --> 00:00:41,600
In this case when the Linklaters of all and then three, the middle node.

16
00:00:41,600 --> 00:00:45,410
So I have to return the node three right now.

17
00:00:45,410 --> 00:00:53,660
Let's consider this case when the length is basically even so one, two, three, four, five and six.

18
00:00:54,470 --> 00:00:59,630
So in this case basically the length is even so there are two, three and four.

19
00:00:59,780 --> 00:01:02,060
So two me are there now out of these two.

20
00:01:02,390 --> 00:01:03,920
I have to return the second.

21
00:01:04,430 --> 00:01:08,350
OK, so I have to return the second node.

22
00:01:08,870 --> 00:01:09,980
So I have to return for.

23
00:01:11,490 --> 00:01:13,180
So I hope you understood the question.

24
00:01:13,440 --> 00:01:15,780
Now let's see how we can solve this question.

25
00:01:16,050 --> 00:01:21,420
So first way of solving this question is basically first find out the length of the linked list.

26
00:01:22,480 --> 00:01:25,740
OK, so in this case, what is the length of the list five?

27
00:01:25,950 --> 00:01:28,830
In this case, what is the length of the six?

28
00:01:28,980 --> 00:01:33,040
OK, so first step is done now in the second step, what we will do.

29
00:01:33,060 --> 00:01:36,840
So you will do length by two, you will do length by two.

30
00:01:36,840 --> 00:01:40,560
So five by two is basically integer, one integer is basically two.

31
00:01:40,830 --> 00:01:43,910
And similarly what is six by two is three.

32
00:01:43,950 --> 00:01:44,340
Right.

33
00:01:44,640 --> 00:01:50,120
So this is index zero, index one, index two and three and index four.

34
00:01:50,310 --> 00:01:56,130
Now the third step is basically iterate how many times leant upon two times.

35
00:01:56,730 --> 00:02:00,600
So you can see lent by two is two and you can see.

36
00:02:00,600 --> 00:02:04,980
So the node three is present at index also first and second iteration.

37
00:02:04,980 --> 00:02:08,180
So you have to add rate length by two number of times.

38
00:02:08,340 --> 00:02:09,410
Simple, right.

39
00:02:09,870 --> 00:02:13,680
And in this case also lent about two was three and you can say zero.

40
00:02:13,740 --> 00:02:15,720
You can see zero, one, two and three.

41
00:02:16,020 --> 00:02:20,520
So the node for its present at the the N-word is index three.

42
00:02:20,520 --> 00:02:22,490
So index three is basically linked by two.

43
00:02:22,680 --> 00:02:28,500
So we have divided three times one time, a second time and basically third time.

44
00:02:28,830 --> 00:02:29,250
Right.

45
00:02:29,460 --> 00:02:32,520
So we can solve this question by finding out the length.

46
00:02:32,670 --> 00:02:38,600
Then we will do length by two and then we will get that much number of times simple now.

47
00:02:38,880 --> 00:02:45,630
So basically we are traversing the linked list two times, so we are traversing the linked list two

48
00:02:45,630 --> 00:02:46,070
times.

49
00:02:47,970 --> 00:02:52,290
So first time we will traverse to find out the length.

50
00:02:53,100 --> 00:02:53,580
Right.

51
00:02:53,760 --> 00:03:00,330
And the second time we will traverse the linked list to find out the middle element and we will do length

52
00:03:00,330 --> 00:03:00,680
by two.

53
00:03:00,720 --> 00:03:02,900
OK, we related leant upon two times.

54
00:03:03,150 --> 00:03:09,680
So if I will use this approach, finding the length first and then finding out the middle element.

55
00:03:09,990 --> 00:03:12,630
So I am traversing the list two times.

56
00:03:13,540 --> 00:03:17,400
OK, so I hope you understood what is the meaning of two times or two times.

57
00:03:17,400 --> 00:03:20,820
What I want to say is first of all, you have to find the length, right?

58
00:03:21,180 --> 00:03:22,590
First of all, you have to find the length.

59
00:03:22,590 --> 00:03:24,840
That means you will I draw the link list.

60
00:03:25,170 --> 00:03:30,180
So this is one traversal now, the second time you will like trade over the link list and length by

61
00:03:30,180 --> 00:03:31,150
two number of times.

62
00:03:31,170 --> 00:03:32,850
So this is your second traversal.

63
00:03:33,300 --> 00:03:35,380
So that is the meaning of two traversal.

64
00:03:35,400 --> 00:03:39,330
OK, so this is we are travelling two times.

65
00:03:39,930 --> 00:03:45,480
But the question is, let's say the question is find the midpoint of the linked list in one traversal

66
00:03:45,480 --> 00:03:47,710
in only a single one traversal.

67
00:03:47,760 --> 00:03:50,790
OK, we cannot traverse the list two times.

68
00:03:50,850 --> 00:03:56,460
We have to traverse the link list only once and then find out the better part of the linked list.

69
00:03:57,510 --> 00:04:00,020
So can you solve this question?

70
00:04:01,290 --> 00:04:02,260
So it's very easy.

71
00:04:03,150 --> 00:04:12,210
So this approach and the approach is called slow and fast pointer approach, slow and fast pointer approach.

72
00:04:12,480 --> 00:04:21,240
Now, what this approach says is basically so consider or lengthening list one, two, three, four

73
00:04:21,240 --> 00:04:21,820
and five.

74
00:04:22,200 --> 00:04:29,420
OK, and we will also consider even lengthening list one, then two, three, four, five and six.

75
00:04:30,270 --> 00:04:32,890
So what is slow and fast pointer approach?

76
00:04:32,910 --> 00:04:34,370
So it is a very simple approach.

77
00:04:34,380 --> 00:04:44,750
It is a slow pointer at the hard and fast pointer next offered OK and similarly slow pointer initially

78
00:04:44,760 --> 00:04:49,570
slow pointer will be present at the hard and fast pointer will be presented next of.

79
00:04:49,860 --> 00:04:52,660
OK, so first step is basically initialization.

80
00:04:53,040 --> 00:05:03,230
Now this approach is slow pointer will make will take a jump of one and fast pointer will take two jumps.

81
00:05:03,990 --> 00:05:05,490
OK, so what is the meaning.

82
00:05:05,670 --> 00:05:09,360
So I want to say slow will take a jump of one.

83
00:05:09,510 --> 00:05:14,550
So slow equals next of slow and fast will take a jump of two.

84
00:05:14,850 --> 00:05:17,920
So fast equals next of next of fast.

85
00:05:18,910 --> 00:05:23,400
OK, so the logic is slow.

86
00:05:23,400 --> 00:05:27,540
Will take a jump of one correct and fast will take a jump of two.

87
00:05:27,660 --> 00:05:31,470
So this is taking a jump of one and this is taking a jump of two.

88
00:05:31,650 --> 00:05:36,920
So the logic is so finally we have Nele here and finally we have Nele here.

89
00:05:37,650 --> 00:05:46,980
So the logic, the main idea behind this approach is basically when fast reaches none.

90
00:05:47,630 --> 00:05:55,320
OK, so when Fosterville Regional, then basically Uslu will be present at mid.

91
00:05:56,280 --> 00:05:57,270
OK, understood.

92
00:05:57,510 --> 00:06:00,360
So this is the core idea of this approach.

93
00:06:01,640 --> 00:06:02,620
So what is the idea?

94
00:06:03,000 --> 00:06:05,220
So you have to point us slow and fast.

95
00:06:05,220 --> 00:06:10,170
Fast is taking a jump off too slow is taking a jump of one then basically when.

96
00:06:10,330 --> 00:06:16,110
Fosterville reach the end of the limitlessness only means the end of the list, then basically global

97
00:06:16,110 --> 00:06:18,710
reach at the middle of the list, right.

98
00:06:19,500 --> 00:06:20,820
It is very obvious, right?

99
00:06:21,270 --> 00:06:24,720
Fastest moving twice the speed of slow.

100
00:06:24,750 --> 00:06:28,320
OK, so the fast speed is twice the speed of a slow.

101
00:06:28,950 --> 00:06:34,000
So fast is moving with quite the speed of slow, two times the speed of slow.

102
00:06:34,200 --> 00:06:38,090
So it is obvious when Fosterville reach the end of the linked list.

103
00:06:38,140 --> 00:06:39,420
This is the end of the list.

104
00:06:39,690 --> 00:06:43,260
Then slow pointer will reach the middle of the list.

105
00:06:43,560 --> 00:06:45,090
So let's see how.

106
00:06:45,430 --> 00:06:47,610
OK, so Slovik, take a jump of one.

107
00:06:48,780 --> 00:06:54,750
Oslo is here, and it simultaneously forced you to jump off to so fast, takes a jump off to.

108
00:06:57,380 --> 00:07:03,680
Now, again, snow takes a jump of one, so snow takes a jump of one, and Fosterville take a jump of

109
00:07:03,680 --> 00:07:06,110
two so fast takes a jump of two.

110
00:07:06,980 --> 00:07:12,770
Now you can see when fast reaches nul, then very slow.

111
00:07:12,980 --> 00:07:19,280
So your slow is present at the midpoint of the enclosed right slow, especially at the midpoint of the

112
00:07:19,520 --> 00:07:19,750
lift.

113
00:07:19,780 --> 00:07:22,340
Now let's consider even case also.

114
00:07:23,310 --> 00:07:27,170
OK, let's consider even case so slow takes a jump of one.

115
00:07:27,170 --> 00:07:32,280
So this is your slow and fast will take a jump of two at the same time.

116
00:07:32,840 --> 00:07:40,550
OK, so this is at the same time simultaneously and fast jump so fast we'll reach here.

117
00:07:41,750 --> 00:07:42,320
Simple.

118
00:07:42,710 --> 00:07:44,360
Now a slow takes a jump of one.

119
00:07:44,780 --> 00:07:49,190
OK, so this is my slow and fast take the jump off to.

120
00:07:49,340 --> 00:07:51,110
OK, so this is your first.

121
00:07:53,830 --> 00:07:58,520
Now, one thing to observe here is can fast take two jumps now.

122
00:07:59,830 --> 00:08:01,030
No, it is not possible.

123
00:08:01,150 --> 00:08:03,470
It is not possible because the next fastest.

124
00:08:03,910 --> 00:08:11,260
OK, so here we cannot take two jumps and why we cannot take two jumps because fast or next.

125
00:08:11,290 --> 00:08:12,700
So this part is null.

126
00:08:13,540 --> 00:08:15,620
And I told you what is the rule.

127
00:08:16,360 --> 00:08:20,530
So whenever you have something and after that you have next.

128
00:08:21,160 --> 00:08:23,380
That means this thing should exist.

129
00:08:24,640 --> 00:08:28,540
And if this thing does not exist, then basically you will get a random error.

130
00:08:28,590 --> 00:08:33,600
OK, so this thing cannot be this thing cannot win an otherwise you will get married.

131
00:08:34,299 --> 00:08:35,740
Now if you will see carefully.

132
00:08:36,070 --> 00:08:38,480
So the next of fast is basically nil.

133
00:08:38,530 --> 00:08:40,090
So I can not take two jumps.

134
00:08:40,520 --> 00:08:41,980
That means I have to stop here.

135
00:08:43,030 --> 00:08:44,610
I have to stop here.

136
00:08:44,830 --> 00:08:52,270
So if I'm stopping here, check slow, slow, slow is at three and three is not actually the end for

137
00:08:52,270 --> 00:08:53,010
both Halmet.

138
00:08:53,020 --> 00:08:55,600
But I have discussed above that we have to return.

139
00:08:56,410 --> 00:09:00,170
OK, we have to return second made and not the first bit.

140
00:09:00,490 --> 00:09:01,630
So what we will return.

141
00:09:01,630 --> 00:09:04,210
We will return slower or next.

142
00:09:05,050 --> 00:09:06,000
Simple, right.

143
00:09:06,130 --> 00:09:07,030
So what is slow.

144
00:09:07,030 --> 00:09:10,840
Slow is basically this law and what is slower next.

145
00:09:10,840 --> 00:09:13,890
And this is basically this not OK, simple.

146
00:09:14,080 --> 00:09:16,070
So that's how it is working now.

147
00:09:16,260 --> 00:09:17,450
Final rule, OK.

148
00:09:17,620 --> 00:09:19,650
So one last time discussion.

149
00:09:20,260 --> 00:09:30,580
So in case of old it is very simple then fast in case of fast will become fast will become null and

150
00:09:30,580 --> 00:09:31,990
you will simply return slow.

151
00:09:32,980 --> 00:09:34,210
It will simply slow.

152
00:09:34,210 --> 00:09:37,600
You can see so this fast, this fast actually becomes null.

153
00:09:38,440 --> 00:09:41,060
And this is your solution which is at the midpoint.

154
00:09:41,590 --> 00:09:46,230
Now in case of even it is a little bit different, fast will not become null.

155
00:09:46,250 --> 00:09:49,060
In fact, the next of fast is becoming well.

156
00:09:50,080 --> 00:09:51,030
OK, you can see.

157
00:09:51,340 --> 00:09:52,480
So this is your first.

158
00:09:52,720 --> 00:09:54,610
So the next hour fast is becoming null.

159
00:09:54,820 --> 00:10:03,280
And that case you can do Denslow, but in the end it is saying that you have to return the second and

160
00:10:03,280 --> 00:10:04,070
not the first.

161
00:10:04,460 --> 00:10:09,290
OK, so for returning the second limit, I have to return slower next.

162
00:10:09,310 --> 00:10:10,510
OK, simple.

163
00:10:13,750 --> 00:10:22,090
Fine, and initially we know initially, so this will be my slow and fast will be the slow will be ahead

164
00:10:22,090 --> 00:10:23,830
and fast will be headed next.

165
00:10:23,860 --> 00:10:25,600
OK, so this is next.

166
00:10:25,780 --> 00:10:28,410
And I hope you understood the question.

167
00:10:28,960 --> 00:10:32,640
Now, this requires only one traversal.

168
00:10:33,940 --> 00:10:36,400
So let me write the call and then I will show you.

169
00:10:36,430 --> 00:10:39,540
OK, so this question is basically present.

170
00:10:39,540 --> 00:10:40,220
Don't let go.

171
00:10:40,330 --> 00:10:44,350
OK, so this question is present only today and we will write the code here.

172
00:10:45,490 --> 00:10:47,540
So we have the written list not start.

173
00:10:47,920 --> 00:10:52,900
OK, so the name of the function is Matalote and we are receiving as input.

174
00:10:52,900 --> 00:10:58,180
And if you read the question, the question is, so if there are two middle nodes, then you have to

175
00:10:58,180 --> 00:10:59,290
return the second model.

176
00:10:59,590 --> 00:11:00,530
OK, fine.

177
00:11:02,470 --> 00:11:03,860
So as discussed.

178
00:11:04,120 --> 00:11:05,290
So what we discussed.

179
00:11:07,710 --> 00:11:15,530
So I told you, if you have a long list to one, two, three and five, so I'm taking two pointers initially,

180
00:11:15,540 --> 00:11:18,630
this will be my solo and this will be my first.

181
00:11:19,720 --> 00:11:26,850
And in case of forward, what will happen so your fast becomes null and you will Denselow.

182
00:11:29,340 --> 00:11:39,330
In case of even the next of fast becomes null and according to the question, you have to return.

183
00:11:40,520 --> 00:11:47,150
The next off slow, OK, so slow arrow next you can see so you can we have to return the second model

184
00:11:49,580 --> 00:11:50,450
symbol, right?

185
00:11:50,810 --> 00:11:52,520
So now let us write the code.

186
00:11:54,740 --> 00:12:03,340
So let's stick to Pointer North Star, slow, slow is presented, OK, initialization and very fast

187
00:12:03,350 --> 00:12:03,830
present.

188
00:12:06,440 --> 00:12:10,670
So fast is president at the next office.

189
00:12:10,770 --> 00:12:15,990
OK, so you can see slow is initially here and fast is here.

190
00:12:17,120 --> 00:12:18,650
So now we have to do so.

191
00:12:18,650 --> 00:12:19,550
We have to hydrate.

192
00:12:21,050 --> 00:12:24,230
So while fast is not to cause trouble, but you have to also.

193
00:12:24,230 --> 00:12:32,510
Right the next hour, fast is also not because fast is going to make two jumps.

194
00:12:32,680 --> 00:12:39,710
OK, so if this condition is too slow, takes a jump of one, so slow equals next slow and fast takes

195
00:12:39,710 --> 00:12:40,460
a jump of two.

196
00:12:41,300 --> 00:12:42,440
So fast equals.

197
00:12:45,560 --> 00:12:51,620
Next of next hour, fast, simple, right, when you will come out of this very loop.

198
00:12:51,870 --> 00:12:54,050
So there are two ways of coming out of this loop.

199
00:12:54,440 --> 00:12:57,800
Either the fast will become known or the fast growing next will become known.

200
00:12:58,320 --> 00:13:00,200
OK, so if basically.

201
00:13:02,580 --> 00:13:04,890
If fast around external.

202
00:13:06,120 --> 00:13:09,150
Or you can say so if fast exist.

203
00:13:10,050 --> 00:13:11,430
OK, let me write like this.

204
00:13:11,460 --> 00:13:14,420
So if faster than external, that means

205
00:13:16,980 --> 00:13:22,800
so that means basically you have equivalent, right.

206
00:13:23,310 --> 00:13:29,250
So if you have even learned what you will return, it will return slower next.

207
00:13:31,380 --> 00:13:35,490
Otherwise, what you will have done, you will return slow in case of.

208
00:13:35,850 --> 00:13:36,230
OK.

209
00:13:36,690 --> 00:13:38,250
So this is in case of hard.

210
00:13:39,470 --> 00:13:42,750
So I think this is pretty much that we have to do.

211
00:13:43,460 --> 00:13:45,240
So let's see how it is working.

212
00:13:46,310 --> 00:13:51,560
So this is I told you, this is the initial step again, the initialization step.

213
00:13:52,200 --> 00:13:53,030
OK, fine.

214
00:13:53,300 --> 00:13:59,720
And see, I told you, whenever you are putting next in ahead of something, then basically that thing

215
00:13:59,730 --> 00:14:00,830
should exist right.

216
00:14:01,370 --> 00:14:03,130
So fast.

217
00:14:03,350 --> 00:14:04,470
Next should exist.

218
00:14:04,490 --> 00:14:06,360
So that's why I wrote this condition.

219
00:14:06,650 --> 00:14:11,690
OK, and should exist because you are putting next in front of us.

220
00:14:11,840 --> 00:14:17,330
So that's why this condition and obviously we have to choose and operator simple right now, when you

221
00:14:17,330 --> 00:14:18,790
will come out of this, why loop.

222
00:14:19,010 --> 00:14:23,260
So either you have our lengthening list or do you have event linked list.

223
00:14:23,420 --> 00:14:27,660
So if you have even lengthening list, then basically this is the condition.

224
00:14:27,680 --> 00:14:33,200
So I am checking if the next of fastest and then yes, it is then basically as decided we have to return

225
00:14:33,200 --> 00:14:33,860
this next.

226
00:14:34,230 --> 00:14:39,410
So we are returning the extra flow and in case of Ford, you will simply return slow.

227
00:14:39,440 --> 00:14:42,650
So that's why I'm returning slow in case of Aadland linked list.

228
00:14:43,040 --> 00:14:46,570
So you can see here this is only one traversal.

229
00:14:48,320 --> 00:14:50,870
So we are traversing the linked list only once.

230
00:14:51,410 --> 00:14:54,200
We are traversing the linked list only once.

231
00:14:54,500 --> 00:14:59,380
OK, so we are doing single traversal to find out the middle order in our previous approach.

232
00:14:59,720 --> 00:15:06,770
First we were finding the length and for finding the length of one traversal and for finding the middle

233
00:15:06,770 --> 00:15:12,210
road we have to do we have to iterate at length about two times to find out the middle road.

234
00:15:12,340 --> 00:15:14,320
OK, so there was two traversal.

235
00:15:14,390 --> 00:15:15,950
Now this is one traversal.

236
00:15:16,130 --> 00:15:17,300
So which one is better?

237
00:15:17,630 --> 00:15:24,140
This approach, this slow and fast pointer approach, so slow and fast pointer approach is very good.

238
00:15:24,590 --> 00:15:26,750
OK, so this is better than this approach.

239
00:15:27,950 --> 00:15:29,870
All the time complexities seem right.

240
00:15:30,060 --> 00:15:32,540
So time complexity in both cases that big often.

241
00:15:32,990 --> 00:15:35,420
But in this approach we have one traversal.

242
00:15:35,420 --> 00:15:40,880
In this approach we have to traversal and law enforcement approach is very important and it is used

243
00:15:40,880 --> 00:15:41,720
in many places.

244
00:15:42,080 --> 00:15:43,730
So the logic was very simple.

245
00:15:43,730 --> 00:15:49,550
I am repeating myself fast is moving two times the speed of slow.

246
00:15:50,210 --> 00:15:57,320
So when fast will reach the end of the list, then slow will basically reach the middle of the list.

247
00:15:57,320 --> 00:15:59,420
And that is the logic behind this approach.

248
00:16:00,020 --> 00:16:05,030
So now let us test our solution with our solution is basically correct or not.

249
00:16:05,300 --> 00:16:06,980
So let me test our solution.

250
00:16:09,600 --> 00:16:14,590
So one thing that we did wrong here is basically we are using Nolde and you will see the structure.

251
00:16:14,610 --> 00:16:18,990
So we have listner, OK, and we have to return restored and not in order.

252
00:16:19,000 --> 00:16:21,030
So let's replace this.

253
00:16:21,060 --> 00:16:22,590
This is not the civil list.

254
00:16:23,190 --> 00:16:27,820
OK, so this will be listner and I think so this is held right.

255
00:16:27,840 --> 00:16:28,260
OK.

256
00:16:28,350 --> 00:16:30,390
OK, yeah.

257
00:16:30,390 --> 00:16:33,510
So first we will run this code and then we will submit.

258
00:16:33,510 --> 00:16:34,890
OK, so first run code.

259
00:16:41,480 --> 00:16:43,220
So we are getting an error here, OK?

260
00:16:43,240 --> 00:16:45,940
So can you guess why we are getting an error here?

261
00:16:46,220 --> 00:16:47,280
So it's very simple.

262
00:16:47,300 --> 00:16:49,200
I did a very silly mistake.

263
00:16:49,640 --> 00:16:54,200
So what we are doing here, we are using we are writing fast eru next.

264
00:16:54,230 --> 00:16:56,580
OK, so at this time we are writing faster.

265
00:16:56,900 --> 00:16:58,550
Now what if fast isn't a.

266
00:16:59,560 --> 00:17:03,700
OK, so what the fastest then we are, we will get a right.

267
00:17:04,599 --> 00:17:11,050
So instead of taking fast next, we're going to begin simply check if fast exist, we can simply check

268
00:17:11,050 --> 00:17:11,900
it first exist.

269
00:17:12,670 --> 00:17:13,690
So let me do that.

270
00:17:15,650 --> 00:17:21,740
So instead of writing this condition, you can simply write it first exist, so if that means this is

271
00:17:21,740 --> 00:17:28,420
even and I can assure you see in this case, in case of.

272
00:17:29,480 --> 00:17:31,600
So in case of Ford fast becomes.

273
00:17:32,300 --> 00:17:35,350
That means in case of even fast will not be.

274
00:17:35,600 --> 00:17:38,870
OK, so in case of even fast is not only.

275
00:17:40,490 --> 00:17:41,330
Simple, right?

276
00:17:41,540 --> 00:17:49,850
So I'm using this condition in case of even faster, not so in case of even fast exist how to use this

277
00:17:49,850 --> 00:17:53,990
line if fast exist or you can simply ride like this.

278
00:17:54,050 --> 00:17:57,920
So if fast is not questionable, voters seem OK now.

279
00:17:57,920 --> 00:17:58,700
Rancourt again.

280
00:18:03,740 --> 00:18:04,890
OK, so accepted.

281
00:18:05,270 --> 00:18:10,460
So this was the input provided by the this website and I would expect it out.

282
00:18:10,480 --> 00:18:14,170
This is our output three, four, five, and this is the expected output, three, four, five.

283
00:18:14,570 --> 00:18:19,810
And how this is the expected output, because what it is doing here is we are returning the middle order.

284
00:18:19,820 --> 00:18:23,950
So we turning three and this in the back end of late.

285
00:18:24,980 --> 00:18:29,200
So what they are doing, they are printing everything starting from the middle to the end.

286
00:18:29,210 --> 00:18:30,710
So they are printing three, four, five.

287
00:18:31,130 --> 00:18:33,300
And the expected output was also three, four, five.

288
00:18:33,320 --> 00:18:35,280
OK, so that's how it is working.

289
00:18:35,570 --> 00:18:40,490
So after I accepted, now we will submit our code and let's see whether our code is correct or not.

290
00:18:41,750 --> 00:18:43,100
So let's meet our code.

291
00:18:45,240 --> 00:18:47,790
So here you will see the solution.

292
00:18:47,830 --> 00:18:52,920
OK, so success means our goal is working and our goal is basically faster than a hundred percent of

293
00:18:52,920 --> 00:18:56,130
the C++ submission made for this question list.

294
00:18:56,140 --> 00:18:58,100
OK, so I will share this quote with you.

295
00:18:58,380 --> 00:19:00,770
So if you have any doubt in this question, you can ask me.

296
00:19:00,780 --> 00:19:01,560
OK, thank you.

