1
00:00:01,220 --> 00:00:01,790
Hi everyone.

2
00:00:01,790 --> 00:00:06,400
So in this video we are going to solve this question spider Lord metrics.

3
00:00:06,440 --> 00:00:08,090
Okay so what is input.

4
00:00:08,150 --> 00:00:11,930
So input is basically a matrix and what we have to do so we have to.

5
00:00:11,960 --> 00:00:14,280
I was the matrix and Spider and order.

6
00:00:14,480 --> 00:00:15,140
OK.

7
00:00:15,440 --> 00:00:18,040
I was the matrix in spider Lord.

8
00:00:18,200 --> 00:00:20,170
Now let us consider this matrix OK.

9
00:00:20,180 --> 00:00:23,150
Let us go through this example and let us try to find it.

10
00:00:23,150 --> 00:00:25,430
Spider Lord so spider Lord I will be

11
00:00:32,080 --> 00:00:32,310
OK.

12
00:00:32,320 --> 00:00:39,340
So this is the spider order so its output should be 1 2 3 then 6 9 8 7 4 and 5.

13
00:00:39,340 --> 00:00:39,860
OK.

14
00:00:39,880 --> 00:00:41,030
So this is the output.

15
00:00:41,050 --> 00:00:43,630
This is this battle order traversal for this matrix.

16
00:00:43,860 --> 00:00:44,350
OK.

17
00:00:44,470 --> 00:00:47,560
Now let us perform this piloted traversal cell for this metrics.

18
00:00:47,560 --> 00:00:48,250
OK.

19
00:00:48,490 --> 00:00:49,360
So let's start

20
00:00:54,970 --> 00:00:55,200
OK.

21
00:00:55,210 --> 00:01:00,430
So this is the spider that I was in for this matrix though its output should be one then two then three

22
00:01:00,490 --> 00:01:01,730
then food eight.

23
00:01:01,830 --> 00:01:09,980
Well then eleven then 10 then nine then five then six and then seven.

24
00:01:10,000 --> 00:01:14,320
Okay so this is this pilot that I for this matrix.

25
00:01:14,320 --> 00:01:15,520
Okay.

26
00:01:15,520 --> 00:01:25,780
Now let us perform this pilot traversal for this matrix so this will be then this then this then this

27
00:01:25,930 --> 00:01:28,250
then this then this.

28
00:01:28,350 --> 00:01:28,920
Okay.

29
00:01:29,110 --> 00:01:30,790
So it s spider I will be.

30
00:01:30,790 --> 00:01:33,050
So one two three four.

31
00:01:33,130 --> 00:01:34,300
Then I have eight.

32
00:01:34,330 --> 00:01:45,020
Well sixteen after 16 I have fifteen then 14 then 13 13 then nine then five then six then seven then

33
00:01:45,080 --> 00:01:45,530
eleven.

34
00:01:45,530 --> 00:01:46,160
And then 10.

35
00:01:46,250 --> 00:01:46,810
Okay.

36
00:01:46,880 --> 00:01:51,080
So for this matrix for this matrix this is this battle order but I was 10.

37
00:01:51,110 --> 00:01:51,570
Okay.

38
00:01:51,800 --> 00:01:56,760
Now let us consider one more example and let us find out these by law order for this metrics.

39
00:01:56,870 --> 00:01:57,710
So this will be

40
00:02:02,310 --> 00:02:03,050
so this one.

41
00:02:03,080 --> 00:02:10,340
Okay so let's pilot that is basically one two three four five six then twelve then eighteen then seventeen

42
00:02:10,340 --> 00:02:16,720
sixteen fifteen fourteen thirteen seven eight nine ten and eleven.

43
00:02:16,730 --> 00:02:19,730
Okay so what this matrix this is this pilot and I listen.

44
00:02:19,770 --> 00:02:22,270
Okay so I hope you've got the idea.

45
00:02:22,280 --> 00:02:24,470
So I have to but I was the medics in this fashion

46
00:02:27,480 --> 00:02:28,300
then inside

47
00:02:33,850 --> 00:02:39,170
OK so I have to repeat I was the metrics in this fashion.

48
00:02:39,390 --> 00:02:46,250
OK so we are traversing the medics in this fashion.

49
00:02:46,420 --> 00:02:49,690
OK so this is this pilot I was sitting now let us consider.

50
00:02:49,760 --> 00:02:52,050
Now let us discuss how we can solve this caution.

51
00:02:52,070 --> 00:02:52,730
OK.

52
00:02:52,730 --> 00:02:55,730
So basically this is just implementation problem.

53
00:02:55,760 --> 00:02:58,150
So what I will do I will take for variables.

54
00:02:58,270 --> 00:03:01,900
OK so this is simply an implementation problem.

55
00:03:01,910 --> 00:03:04,850
Now to implement this pilot I whistle What do we need.

56
00:03:04,850 --> 00:03:07,160
So we need four variables.

57
00:03:07,160 --> 00:03:09,010
We simply need for two variables.

58
00:03:09,020 --> 00:03:14,750
Okay so start rule Andrew start column and column.

59
00:03:14,770 --> 00:03:15,160
Okay.

60
00:03:15,200 --> 00:03:19,550
So with the help of these four variables we will be able to solve that equation.

61
00:03:19,550 --> 00:03:21,930
Okay so let us consider a metrics.

62
00:03:21,950 --> 00:03:26,960
So okay so let no do not consider this type of metric so consider this metrics.

63
00:03:26,990 --> 00:03:28,340
So I have this metrics

64
00:03:31,970 --> 00:03:32,830
okay.

65
00:03:33,220 --> 00:03:36,730
So what we do with the value of start rule so start probably be here.

66
00:03:36,730 --> 00:03:37,220
Okay.

67
00:03:37,360 --> 00:03:41,120
So start rule will be here working with the value of Andrew.

68
00:03:41,110 --> 00:03:52,050
So Andrew will be here start column so start column will be here and column will be here okay.

69
00:03:52,180 --> 00:03:56,760
So what I will do first of all I would like trade I have to print in this fashion.

70
00:03:56,770 --> 00:03:57,110
Okay.

71
00:03:57,130 --> 00:03:59,710
In this fashion then inside.

72
00:04:00,070 --> 00:04:02,270
So first I have to print this start.

73
00:04:02,560 --> 00:04:06,540
So let us print this a structural softer printing to start what I will do.

74
00:04:06,540 --> 00:04:11,620
I will print this and column after printing this column.

75
00:04:11,680 --> 00:04:12,990
I will print this.

76
00:04:13,030 --> 00:04:15,220
Andrew after printing this.

77
00:04:15,220 --> 00:04:16,570
Andrew what I will do.

78
00:04:16,570 --> 00:04:17,590
I will print this.

79
00:04:17,620 --> 00:04:21,270
Start column I will print this the start column.

80
00:04:21,280 --> 00:04:21,780
Okay.

81
00:04:21,790 --> 00:04:28,450
So after doing this what I will do I will do basically start plus plus I will do Andrew minus minus

82
00:04:28,750 --> 00:04:35,250
start plus plus because start has been printed Andrew minus minus because Andrew has been printed.

83
00:04:35,320 --> 00:04:37,850
Okay start column plus plus.

84
00:04:37,990 --> 00:04:40,610
Because start column has been printed.

85
00:04:40,750 --> 00:04:46,210
Okay the column we will do and column minus minus because the end column has been printed.

86
00:04:46,270 --> 00:04:47,340
Okay.

87
00:04:47,530 --> 00:04:55,000
I mean a building myself I will do start troop plus plus because this start rule has been printed I

88
00:04:55,000 --> 00:05:01,180
will do Andrew minus minus because the Andrew has been printed I will loose start column plus plus because

89
00:05:01,240 --> 00:05:06,880
the start column has been printed I will do and the column minus minus because the end column has been

90
00:05:06,880 --> 00:05:07,600
printed.

91
00:05:07,600 --> 00:05:10,530
Okay so after doing this what little movie I situation.

92
00:05:10,720 --> 00:05:12,280
So this will be my new matrix

93
00:05:15,920 --> 00:05:16,200
okay.

94
00:05:16,250 --> 00:05:24,480
So this is basically this is basically these start to because I have done started hopelessness this

95
00:05:24,540 --> 00:05:31,620
will be my Andrew because I have done Andrew minus minus this will be my start column because I did

96
00:05:31,710 --> 00:05:38,640
start column plus plus and this will be my end column because I did and column minus minus.

97
00:05:38,640 --> 00:05:46,470
Okay so again we will follow the same approach I will print these start true I will print the end column

98
00:05:46,830 --> 00:05:53,160
I will print the Andrew I will print the start column okay.

99
00:05:53,160 --> 00:05:58,800
After doing this we will perform these four steps again will perform this fourth step again.

100
00:05:58,860 --> 00:06:04,180
So again this will be my inner matrix I performed star listless.

101
00:06:04,200 --> 00:06:07,280
So this will be my star true similarly.

102
00:06:07,280 --> 00:06:08,460
This will be my start.

103
00:06:08,460 --> 00:06:10,540
Gollum because I didn't start Gollum plus.

104
00:06:10,550 --> 00:06:14,120
This will be my end column because I did and column minus minus.

105
00:06:14,240 --> 00:06:18,950
And this will be my Andrew because I did Andrew minus minus.

106
00:06:18,950 --> 00:06:19,360
Okay.

107
00:06:19,490 --> 00:06:21,640
So again we will do the same thing.

108
00:06:21,780 --> 00:06:24,410
Print these start to print the end column.

109
00:06:24,410 --> 00:06:28,130
Print the Andrew and print the start column.

110
00:06:28,130 --> 00:06:28,590
Okay.

111
00:06:28,640 --> 00:06:30,610
And again we will update these values.

112
00:06:30,620 --> 00:06:33,560
So how long I have to perform these operations.

113
00:06:33,650 --> 00:06:41,480
So start rule basically start rule should be less than adequate to Andrew obviously and basically start

114
00:06:41,480 --> 00:06:44,990
column start column should be less than adequate to and column.

115
00:06:44,990 --> 00:06:50,870
Okay so this will be my condition I will write this condition inside of my loop on inside a for loop

116
00:06:51,140 --> 00:06:54,850
and I will perform these steps and I will perform these steps.

117
00:06:54,890 --> 00:06:58,000
Okay so very simple implementation problem.

118
00:06:58,080 --> 00:06:58,590
Okay.

119
00:06:58,670 --> 00:07:02,840
Very very simple implementation problem and let take.

120
00:07:02,870 --> 00:07:04,910
We will also take account variable.

121
00:07:05,330 --> 00:07:09,210
So initially this going to be able to we basically will be zero.

122
00:07:09,260 --> 00:07:13,200
But to have to do so how many elements will be present inside the matrix.

123
00:07:13,340 --> 00:07:14,980
So if the dimensions that I mean.

124
00:07:15,450 --> 00:07:15,690
Okay.

125
00:07:15,710 --> 00:07:18,050
So this is the their mission and crossing.

126
00:07:18,410 --> 00:07:20,890
So how many elements would be present inside the matrix.

127
00:07:20,930 --> 00:07:23,120
So I mean elements would loop present.

128
00:07:23,120 --> 00:07:27,470
So as soon as the count will become it goes to I mean I will stop.

129
00:07:27,470 --> 00:07:27,960
Okay.

130
00:07:28,040 --> 00:07:30,400
So this is one stopping condition.

131
00:07:30,740 --> 00:07:34,550
This is first a stopping condition and this is second stopping condition.

132
00:07:34,580 --> 00:07:34,990
Okay.

133
00:07:35,090 --> 00:07:38,000
So count restored stored how many elements I have printed.

134
00:07:38,460 --> 00:07:38,700
Okay.

135
00:07:38,720 --> 00:07:42,490
So this variable will stored how many elements has been printed.

136
00:07:42,710 --> 00:07:45,260
So that's when is the count of the elements become the question.

137
00:07:45,260 --> 00:07:50,140
I mean that means I have printed all the elements of the matrix then I can stop.

138
00:07:50,150 --> 00:07:54,920
Okay so I have to stop in condition this is the first stopping condition and this one is the second

139
00:07:54,920 --> 00:07:57,740
stopping condition when the count become close to women.

140
00:07:57,770 --> 00:07:59,730
That means I have been and many elements.

141
00:08:00,080 --> 00:08:04,250
So I have printed all the elements of the matrix then I can stop.

142
00:08:04,370 --> 00:08:04,990
Okay.

143
00:08:05,150 --> 00:08:06,170
Very simple.

144
00:08:06,170 --> 00:08:08,160
So just we need 40 variables.

145
00:08:08,200 --> 00:08:10,430
Start rule and start column and column.

146
00:08:10,640 --> 00:08:11,110
Okay.

147
00:08:11,120 --> 00:08:13,010
Initially my star will be zero.

148
00:08:13,040 --> 00:08:15,090
Initially my end column will be zero.

149
00:08:15,230 --> 00:08:20,680
And Andrew will basically be m minus 1 and and column will be n minus 1.

150
00:08:20,690 --> 00:08:24,380
Very simple so this is the equation.

151
00:08:24,400 --> 00:08:25,390
Spiral matrix.

152
00:08:25,420 --> 00:08:31,990
Okay so the input is basically a 2D Matrix and I won't have to print anything I have written that perfectly

153
00:08:31,990 --> 00:08:32,250
just.

154
00:08:32,340 --> 00:08:32,560
Okay.

155
00:08:32,560 --> 00:08:38,240
You can see so if this is the matrix so I have written that perfectly just okay.

156
00:08:38,590 --> 00:08:40,300
Now if you ever understood the logic.

157
00:08:40,300 --> 00:08:42,420
Now let's start writing the code.

158
00:08:42,490 --> 00:08:43,300
Okay.

159
00:08:43,630 --> 00:08:46,240
So as discussed we need for variables.

160
00:08:46,390 --> 00:08:47,540
Okay start.

161
00:08:47,590 --> 00:08:49,910
Okay so let us first find out the size.

162
00:08:50,050 --> 00:08:50,540
Okay.

163
00:08:50,680 --> 00:08:52,130
Let us first find out.

164
00:08:52,140 --> 00:08:52,510
Size.

165
00:08:52,520 --> 00:08:55,440
So M is basically meant to extract size.

166
00:08:55,510 --> 00:08:56,620
How many rules at present.

167
00:08:56,620 --> 00:09:03,510
So many takes a large size and similarly let us find out how many columns are present.

168
00:09:03,610 --> 00:09:09,390
So this will be matrix of 0 large size simple.

169
00:09:09,420 --> 00:09:12,640
Now let us construct our own social construct on set above.

170
00:09:12,720 --> 00:09:16,610
Okay so I have this prof and just set.

171
00:09:16,670 --> 00:09:21,810
Okay so I will push every element inside this answer variable inside this on selector.

172
00:09:21,850 --> 00:09:30,930
Okay now after finding out the size I have to take for variables start rule which will be zero Andrew.

173
00:09:30,960 --> 00:09:34,880
So and there will be m minus 1 and then I have to bake.

174
00:09:34,890 --> 00:09:43,280
Basically start column so start column will be zero start column will be zero and end column.

175
00:09:43,290 --> 00:09:45,910
So what does end columns at this is end minus 1.

176
00:09:45,930 --> 00:09:52,200
Okay so we initialized our variables and I have to also take account variable how many elements has

177
00:09:52,200 --> 00:09:58,320
been printed how many elements has been pushed into this and sort of vector so initially this value

178
00:09:58,320 --> 00:09:59,110
will be zero.

179
00:09:59,170 --> 00:10:05,420
Okay now let us write our condition so vile.

180
00:10:05,420 --> 00:10:13,230
Basically this title is less than our request to Andrew and the start column should be less than order

181
00:10:13,340 --> 00:10:14,050
to hand column.

182
00:10:14,140 --> 00:10:17,530
Okay very simple condition.

183
00:10:17,600 --> 00:10:22,510
Now what I have to do so C carefully first of all I have to print the start.

184
00:10:22,580 --> 00:10:23,200
Okay spider.

185
00:10:23,280 --> 00:10:24,290
Order this one.

186
00:10:24,380 --> 00:10:26,140
So this is the spider order.

187
00:10:26,150 --> 00:10:32,600
So what I have to do I have to first print the title then I have to print the end column.

188
00:10:32,630 --> 00:10:35,680
Okay so this is step one this is step two.

189
00:10:35,810 --> 00:10:42,630
Then I have to print the end through third step and then I have to print the start column Fourth Step.

190
00:10:42,690 --> 00:10:44,000
Okay so in this order.

191
00:10:44,030 --> 00:10:51,780
So this is step one that test by form step 1 So what I have to do so let's print.

192
00:10:51,960 --> 00:10:53,730
Basically these start rule.

193
00:10:53,840 --> 00:10:56,060
Okay I I'm printing this diagram.

194
00:10:56,250 --> 00:10:59,550
So for printing start rule I have to iterate over the columns.

195
00:10:59,610 --> 00:11:06,620
So start column I left tonight it goes straight in column and a plus plus what I have to do.

196
00:11:06,620 --> 00:11:07,870
So long sideboard pushback

197
00:11:11,650 --> 00:11:13,270
I thought pushback metrics.

198
00:11:13,280 --> 00:11:14,420
So this is the metrics.

199
00:11:14,450 --> 00:11:16,310
OK so metrics

200
00:11:18,880 --> 00:11:25,860
so start rule and column is variable again column is a now.

201
00:11:26,110 --> 00:11:27,920
I also have to look on the plus plus.

202
00:11:27,950 --> 00:11:31,310
OK because counties storing how many elements have been printed.

203
00:11:31,330 --> 00:11:37,660
OK so after printing the first after printing the star true what I have to do so I have printed the

204
00:11:37,660 --> 00:11:39,470
star to also start to less plus.

205
00:11:40,250 --> 00:11:41,800
Okay start rule has been printed.

206
00:11:41,860 --> 00:11:45,270
Go to the next title and you can also check.

207
00:11:45,280 --> 00:11:52,940
So basically if the value of count if the value of count to become IT GOES TO M in doing that means

208
00:11:52,970 --> 00:11:54,670
all the elements has been printed.

209
00:11:54,710 --> 00:11:56,360
So basically you can draw down on.

210
00:11:56,690 --> 00:11:59,030
Okay you can read done on set.

211
00:11:59,030 --> 00:12:00,020
So this is the answer.

212
00:12:01,110 --> 00:12:04,890
You're getting it done the onset so step one is done.

213
00:12:04,930 --> 00:12:06,120
Okay so what is it.

214
00:12:06,120 --> 00:12:08,420
Step 2 Step two is very simple.

215
00:12:08,490 --> 00:12:11,640
This one I have to print the end column.

216
00:12:11,640 --> 00:12:15,720
Okay I have to print B and column so that this print the end column

217
00:12:19,310 --> 00:12:20,730
so what bending the end column.

218
00:12:20,790 --> 00:12:30,410
I have quite great all that it was OK to start rule I less than or equal to Andrew I plus press again

219
00:12:30,420 --> 00:12:40,460
to answer dot pushback what I have to lose all metrics off so the rule is variable and I have to print

220
00:12:40,520 --> 00:12:49,440
the end column OK and column and again I have to do count plus plus so let me write the commentary.

221
00:12:49,460 --> 00:12:50,460
So what I'm doing.

222
00:12:50,480 --> 00:12:53,000
So the second step is printing the angle.

223
00:12:53,090 --> 00:12:58,990
Okay I'm printing the N column so after printing the N column let us go back and column minus minus.

224
00:12:59,090 --> 00:13:04,610
Okay and column has been printed and again I will write this condition.

225
00:13:04,610 --> 00:13:11,910
So if the number of elements is it comes to women that means all that element has been printed.

226
00:13:11,910 --> 00:13:16,220
So in that case you can read and the answer allowances Eddie we can draw down I would on set.

227
00:13:16,380 --> 00:13:17,090
Okay.

228
00:13:17,100 --> 00:13:19,720
Now the total step what I have to do.

229
00:13:20,040 --> 00:13:23,040
So this is the third step I have to print the end rule.

230
00:13:23,080 --> 00:13:23,340
Okay.

231
00:13:23,370 --> 00:13:24,240
This is the end.

232
00:13:24,330 --> 00:13:24,990
I have to print.

233
00:13:25,140 --> 00:13:31,730
ANDREW So I have to print Andrew.

234
00:13:32,110 --> 00:13:35,440
So for printing the Andrew I have to print the row in reverse order.

235
00:13:35,470 --> 00:13:35,730
OK.

236
00:13:35,740 --> 00:13:39,190
You can see I have to print that all in this order.

237
00:13:39,460 --> 00:13:43,300
So I will start from and column I will stop at the start column.

238
00:13:43,420 --> 00:13:54,990
OK so I have to start at and column I should be good then I request to start column I minus minus again

239
00:13:55,050 --> 00:14:06,250
answer dot pushback metric self so I am printing the Andrew and the column will vary.

240
00:14:06,320 --> 00:14:07,070
OK.

241
00:14:07,190 --> 00:14:14,300
And again I have to do count plus plus and again after printing the end what I have to do Andrew minus

242
00:14:14,300 --> 00:14:14,760
minus.

243
00:14:14,820 --> 00:14:15,320
OK.

244
00:14:15,510 --> 00:14:19,670
As I have been dead Andrew again you will write the condition.

245
00:14:20,010 --> 00:14:25,710
So if counties it goes to I mean doing that means all the element has been printed so you can write

246
00:14:25,710 --> 00:14:27,260
down the onset.

247
00:14:27,280 --> 00:14:32,820
Okay now a step forward so a step foot is very simple.

248
00:14:32,820 --> 00:14:35,250
So I have to print the start column.

249
00:14:35,280 --> 00:14:35,530
Okay.

250
00:14:35,550 --> 00:14:37,590
I have to print to start column so I will go from.

251
00:14:37,620 --> 00:14:38,990
So this is the start rule.

252
00:14:39,090 --> 00:14:41,210
I will go from Andrew to start.

253
00:14:41,280 --> 00:14:41,550
Okay.

254
00:14:41,560 --> 00:14:48,990
From down to up so now let us print the start column.

255
00:14:48,990 --> 00:14:49,560
Okay.

256
00:14:49,650 --> 00:14:52,800
What I have to do I have to go from down to up.

257
00:14:52,800 --> 00:15:00,900
So I have to go from Andrew I will start from Andrew I will reach these start row I minus minus.

258
00:15:00,900 --> 00:15:02,060
Okay.

259
00:15:02,220 --> 00:15:06,810
Now again answer dot pushback.

260
00:15:06,870 --> 00:15:14,270
So what I have to do so metrics of role will vary so ROIs I and I am printing these start column and

261
00:15:14,280 --> 00:15:18,870
again I have to do count plus plus column distorting how many elements has been printed.

262
00:15:18,870 --> 00:15:23,230
So again after printing the start column I will do start column plus plus.

263
00:15:23,510 --> 00:15:25,400
Okay start column plus plus.

264
00:15:25,530 --> 00:15:27,370
And now you can again check.

265
00:15:27,450 --> 00:15:32,170
So if the value of Countess basically M and when that means all the element has been printed.

266
00:15:32,250 --> 00:15:34,220
So in that case you can pretend you are on set.

267
00:15:34,300 --> 00:15:35,680
Okay.

268
00:15:35,910 --> 00:15:38,520
So I think we have done everything correctly.

269
00:15:38,520 --> 00:15:42,020
Now for the completion purpose since I have written that perfect Tejas.

270
00:15:42,180 --> 00:15:44,700
So let us right denies I here.

271
00:15:44,810 --> 00:15:47,820
Okay so let us write an answer here on TALK

272
00:15:54,830 --> 00:15:55,070
OKAY.

273
00:15:55,070 --> 00:15:56,980
SO WE DID spelling mistake somewhere.

274
00:15:58,440 --> 00:16:00,330
So this will be gone.

275
00:16:00,390 --> 00:16:02,220
Okay now let's go now quote again

276
00:16:06,440 --> 00:16:09,450
okay so our code is looking now in our district to some retired code.

277
00:16:09,530 --> 00:16:09,770
Okay

278
00:16:15,490 --> 00:16:22,430
so I have to check basically the metrics is empty so basically M is zero.

279
00:16:22,440 --> 00:16:27,310
That means metrics is m buddy so in that case you can get done and beyond is that okay.

280
00:16:27,330 --> 00:16:28,630
So at this point.

281
00:16:28,710 --> 00:16:30,120
So this on is empty.

282
00:16:30,120 --> 00:16:30,670
Okay.

283
00:16:30,720 --> 00:16:34,410
If you will run again okay.

284
00:16:34,420 --> 00:16:38,590
So our code is working fine otherwise you can also write one more condition.

285
00:16:39,340 --> 00:16:44,330
So if the number of columns of 0 then also you can draw down the empty onset.

286
00:16:44,380 --> 00:16:46,870
Okay now that some summit

287
00:16:52,170 --> 00:16:52,360
okay.

288
00:16:52,380 --> 00:16:54,020
So our code is working fine.

289
00:16:54,120 --> 00:16:57,470
Now let us discuss the time and the space complexity.

290
00:16:57,750 --> 00:17:01,680
Okay so an order does discuss the timing the space complexity.

291
00:17:01,760 --> 00:17:05,440
So again this base complexity is basically ordered offline.

292
00:17:05,450 --> 00:17:06,060
Okay.

293
00:17:06,080 --> 00:17:11,590
Space complexity is ordered off when we are not looking adding We are not creating any extents.

294
00:17:11,600 --> 00:17:13,520
We are not taking any extra space.

295
00:17:13,700 --> 00:17:21,100
So space is basically order of often and time complexity is basically ordered off and then okay we are

296
00:17:21,100 --> 00:17:25,570
going through each and every element of the metrics we are going through each and every element of the

297
00:17:25,570 --> 00:17:25,980
metric.

298
00:17:25,970 --> 00:17:30,820
So that's why the time complexities I mean m is the number of those and is the number of columns.

299
00:17:30,820 --> 00:17:31,320
Okay.

300
00:17:31,600 --> 00:17:35,920
So it is very simple logic Okay very simple implementation problem.

301
00:17:36,160 --> 00:17:37,810
I am getting the start.

302
00:17:37,990 --> 00:17:42,940
So this is the first to step into the start role then start role plus less so.

303
00:17:42,980 --> 00:17:44,420
Print the end column.

304
00:17:44,530 --> 00:17:50,350
So I'm printing the N column a step two then I am doing and column minus minus then I'm printing the

305
00:17:50,350 --> 00:17:50,900
end.

306
00:17:50,950 --> 00:17:52,410
So I am printing the Andrew.

307
00:17:52,420 --> 00:17:57,670
This is step 3 then I did and minus minus then I am printing the start column.

308
00:17:57,670 --> 00:18:03,020
So this is step put into the start column and then here I have written start column plus plus.

309
00:18:03,040 --> 00:18:08,520
So what will happen this will be my new metrics again I will do.

310
00:18:08,520 --> 00:18:13,170
Step 1 I will lose Step 2 I will lose Step 3 I will lose step forward.

311
00:18:13,470 --> 00:18:13,950
Okay.

312
00:18:14,010 --> 00:18:15,420
So very very simple logic.

313
00:18:16,140 --> 00:18:16,640
Okay.

314
00:18:16,830 --> 00:18:24,400
So this is step one this is step 2 this is step 3 and this is step forward okay I'm in the space complexities

315
00:18:24,470 --> 00:18:26,510
but golf I mean and big offline.

316
00:18:26,530 --> 00:18:26,940
Okay.

317
00:18:27,100 --> 00:18:29,470
So if you have any doubt in this question you can ask me.

318
00:18:29,560 --> 00:18:29,790
Okay.

319
00:18:29,830 --> 00:18:30,220
Thank you.
