1 00:00:01,130 --> 00:00:01,790 Hi, everyone. 2 00:00:01,819 --> 00:00:05,440 So in this video, we are going to solve this question, spiral order matrix. 3 00:00:06,320 --> 00:00:08,119 OK, so what is input? 4 00:00:08,119 --> 00:00:11,180 So input is basically a matrix and what we have to do. 5 00:00:11,190 --> 00:00:14,120 So we have to traverse the matrix and spiral order. 6 00:00:14,330 --> 00:00:17,510 OK, we will traverse the Matrix in spiral order. 7 00:00:18,110 --> 00:00:19,820 Now, let us consider this matrix. 8 00:00:19,850 --> 00:00:23,890 OK, let us consider this example and let us try to find its spiral order. 9 00:00:24,320 --> 00:00:25,430 So Spilotro will be. 10 00:00:31,960 --> 00:00:38,230 OK, so this is a spiral also its output should be one, two, three, then six, nine, eight, seven, 11 00:00:38,230 --> 00:00:39,260 four and five. 12 00:00:39,320 --> 00:00:41,050 OK, so this is the output. 13 00:00:41,080 --> 00:00:43,600 This is this pilot, the traversal for this matrix. 14 00:00:43,790 --> 00:00:47,470 OK, now let us perform this pilot or traversal for this matrix. 15 00:00:47,500 --> 00:00:49,390 OK, so let's start. 16 00:00:54,880 --> 00:00:59,830 OK, so this is the spider traversal for this mattocks, though, its output should be one, then two, 17 00:00:59,830 --> 00:01:01,600 then three, then four, eight. 18 00:01:01,610 --> 00:01:03,190 Well then 11. 19 00:01:03,220 --> 00:01:05,019 Then ten, then nine. 20 00:01:06,400 --> 00:01:09,850 Then five, then six and then seven. 21 00:01:09,920 --> 00:01:14,290 OK, so this is this pilot traversal for this matrix. 22 00:01:14,320 --> 00:01:18,910 OK, now let us perform this pilot or traversal for this matrix. 23 00:01:19,910 --> 00:01:20,840 So this will be. 24 00:01:22,510 --> 00:01:32,170 Then this, then this, then this, then this, then this, OK, so it's Spilotro will be so one, two, 25 00:01:32,170 --> 00:01:37,240 three, four, then I have it well 16 after 16 I have 15. 26 00:01:37,240 --> 00:01:39,220 Then 14, then 13. 27 00:01:40,280 --> 00:01:46,170 Thirteen, then nine, then five, then six, then seven, then 11 and then ten. 28 00:01:46,220 --> 00:01:51,020 OK, so for this matrix, for this matrix, this is this paladar traversal. 29 00:01:51,050 --> 00:01:56,230 OK, now let us consider one more example and let us find out the special order for this matrix. 30 00:01:56,780 --> 00:01:57,710 So this will be. 31 00:02:02,420 --> 00:02:08,960 So this one, OK, so it's that is basically one, two, three, four, five, six, then 12, then 32 00:02:08,960 --> 00:02:16,650 18, then 17, 16, 15, 14, 13, seven, eight, nine, 10 and 11. 33 00:02:16,700 --> 00:02:18,220 OK, so what this mattocks. 34 00:02:18,230 --> 00:02:18,990 This is the spoiler. 35 00:02:19,700 --> 00:02:21,820 OK, so I hope you got the idea. 36 00:02:22,220 --> 00:02:24,440 So I have to traverse the murders in this fashion. 37 00:02:27,430 --> 00:02:28,330 Then inside. 38 00:02:33,730 --> 00:02:37,210 OK, so I have to traverse the Matrix in this fashion. 39 00:02:39,300 --> 00:02:41,910 OK, so we are traversing the Murdochs in this fashion. 40 00:02:46,220 --> 00:02:48,370 OK, so this is this pilot, Trevor said. 41 00:02:48,420 --> 00:02:51,980 Now, let us consider now let us discuss how we can solve this question. 42 00:02:52,060 --> 00:02:55,200 OK, so basically this is just an implementation problem. 43 00:02:55,700 --> 00:02:58,160 So what I will do, I will take four variables. 44 00:02:58,190 --> 00:03:04,100 OK, so this is simply implementation problem now to implement this pilot traversal. 45 00:03:04,110 --> 00:03:04,830 What do we need? 46 00:03:04,850 --> 00:03:06,370 So we need four variables. 47 00:03:07,100 --> 00:03:08,700 We simply need for two variables. 48 00:03:08,920 --> 00:03:14,750 OK, so start Andrew start column and column. 49 00:03:14,780 --> 00:03:19,010 OK, so with the help of these four variables, we will be able to solve our question. 50 00:03:19,500 --> 00:03:21,890 OK, so let us consider a matrix. 51 00:03:21,890 --> 00:03:26,960 So OK, so let's not do not consider this type of matrix or construct this matrix. 52 00:03:26,960 --> 00:03:28,340 So I have this matrix. 53 00:03:31,870 --> 00:03:36,190 OK, so what will be the value of Star Trek, so Star Trek will be here. 54 00:03:36,610 --> 00:03:38,990 OK, so Star Trek will be here. 55 00:03:39,760 --> 00:03:41,110 What would be the value of Andrew? 56 00:03:41,140 --> 00:03:42,400 So Andrew will be here. 57 00:03:44,510 --> 00:03:47,000 Start column, so start Collum will be here. 58 00:03:48,760 --> 00:03:50,020 And Colin will be here. 59 00:03:51,430 --> 00:03:57,060 OK, so what I will do, first of all, I would like to read, I have to print in this fashion, OK, 60 00:03:57,070 --> 00:03:59,700 in this fashion, then inside. 61 00:04:00,010 --> 00:04:02,240 So first I have to print this story through. 62 00:04:02,500 --> 00:04:03,380 So let us print. 63 00:04:03,400 --> 00:04:04,170 This is true. 64 00:04:04,490 --> 00:04:11,240 So after printing the starter, what I will do, I will print this and column after printing this and 65 00:04:11,290 --> 00:04:12,970 column, I will print this. 66 00:04:12,970 --> 00:04:15,220 Andrew after printing this. 67 00:04:15,220 --> 00:04:18,310 Andrew, what I will do, I will print this Astarte column. 68 00:04:19,209 --> 00:04:21,190 I will print this start column. 69 00:04:21,220 --> 00:04:26,170 OK, so after doing this, what I will do, I will do basically start placeless. 70 00:04:26,620 --> 00:04:34,480 I will do Andrew minus minus start because a start has been printed and minus minus because Andrew has 71 00:04:34,480 --> 00:04:35,200 been printed. 72 00:04:35,260 --> 00:04:40,150 OK, start column placeless because start column has been printed. 73 00:04:40,610 --> 00:04:46,240 OK and column we will do and column minus minus because the end column has been printed. 74 00:04:46,270 --> 00:04:55,180 OK, I'm repeating myself, I will start RWB plus plus because this starter has been printed I will 75 00:04:55,180 --> 00:04:58,680 do Andrew minus minus because the Andrew has been printed. 76 00:04:58,960 --> 00:05:02,970 I will start column plus plus because the start column has been printed. 77 00:05:03,160 --> 00:05:07,360 I will do and column minus minus because the end column has been printed. 78 00:05:07,540 --> 00:05:10,200 OK, so after doing this what will be a situation. 79 00:05:10,660 --> 00:05:12,280 So this will be my new matrix. 80 00:05:15,860 --> 00:05:20,210 OK, so this is basically this is basically the Stato. 81 00:05:21,720 --> 00:05:29,280 Because I have done start placeless, this will be my end because I have done and minus minus this will 82 00:05:29,280 --> 00:05:36,720 be my start column because I did start column placeless and this will be my end column because I did. 83 00:05:36,720 --> 00:05:38,920 And column minus minus, OK. 84 00:05:39,090 --> 00:05:41,060 So again, we will follow the same approach. 85 00:05:41,070 --> 00:05:43,410 I will print the stato. 86 00:05:43,680 --> 00:05:46,470 I will print the end column. 87 00:05:46,710 --> 00:05:47,700 I will print. 88 00:05:48,780 --> 00:05:56,310 The Andrew, I will print this column, OK, after doing this, we will perform these four steps again. 89 00:05:57,060 --> 00:05:58,820 We will perform this fourth step again. 90 00:05:58,830 --> 00:06:01,320 So again, this will be my Animatrix. 91 00:06:02,570 --> 00:06:05,600 I performed star toplessness, so this will be my star, Drew. 92 00:06:06,650 --> 00:06:11,900 Similarly, this will be my start column because I did start column plus plus this will be my end column 93 00:06:11,900 --> 00:06:17,360 because I did and column minus minus and this will be my Andrew because I did. 94 00:06:17,360 --> 00:06:18,880 Andrew minus minus. 95 00:06:18,920 --> 00:06:21,440 OK, so again, we will do the same thing. 96 00:06:21,740 --> 00:06:27,830 Print this Dutrow print the and column, print the Andrew and print the start column. 97 00:06:28,100 --> 00:06:30,310 OK, and again we will update these values. 98 00:06:30,560 --> 00:06:37,690 So how long I have to perform these operations to start to basically stato should be less than a request 99 00:06:37,700 --> 00:06:44,940 to Andrew obviously and basically start column, start column should be less than articles and column. 100 00:06:44,960 --> 00:06:46,940 OK, so this will be my condition. 101 00:06:47,750 --> 00:06:53,420 I will write this condition inside available inside a for loop and I will perform these steps and I 102 00:06:53,420 --> 00:06:54,640 will perform these steps. 103 00:06:54,800 --> 00:06:57,440 OK, so very simple implementation problem. 104 00:06:58,040 --> 00:07:00,560 OK, very, very simple implementation problem. 105 00:07:01,760 --> 00:07:07,760 And let us take we will also take a count variable, so initially discount the variable will basically 106 00:07:08,240 --> 00:07:10,600 will be zero, but I have to do so. 107 00:07:10,610 --> 00:07:13,280 How many elements will be present inside the Matrix? 108 00:07:13,310 --> 00:07:14,950 So if the damage is not imminent. 109 00:07:15,410 --> 00:07:16,700 OK, so this is the redemption. 110 00:07:16,700 --> 00:07:17,540 And McCrossin. 111 00:07:18,380 --> 00:07:20,890 So how many elements will be present inside the Matrix? 112 00:07:20,900 --> 00:07:22,830 So many elements will be present. 113 00:07:23,060 --> 00:07:27,200 So as soon as the count will become a to women, I will stop. 114 00:07:27,410 --> 00:07:29,570 OK, so this is one strobing condition. 115 00:07:30,740 --> 00:07:34,530 This is first unstrapping condition and the second stopping condition. 116 00:07:34,550 --> 00:07:38,000 OK, so Count will store how many elements I have printed. 117 00:07:38,400 --> 00:07:42,150 OK, so this variable will store how many elements has been printed. 118 00:07:42,650 --> 00:07:47,600 So as soon as the count of the elements becomes close to that means I have printed all the elements 119 00:07:47,600 --> 00:07:49,580 of the matrix, then I can stop. 120 00:07:50,030 --> 00:07:52,190 OK, so I have to stop in condition. 121 00:07:52,220 --> 00:07:55,760 This is the first unstopping condition and this one is the second stopping condition. 122 00:07:56,060 --> 00:08:01,130 When the count becomes close to I mean, that means I have printed an element, so I have printed all 123 00:08:01,130 --> 00:08:02,090 the elements of the Matrix. 124 00:08:02,090 --> 00:08:03,020 Then I can stop. 125 00:08:04,310 --> 00:08:05,810 OK, very simple. 126 00:08:06,110 --> 00:08:10,530 So just we need 40 variables start through and start column and column. 127 00:08:10,550 --> 00:08:12,820 OK, initially my starter will be zero. 128 00:08:12,950 --> 00:08:19,100 Initially my end column will be zero and Andrew will basically be M minus one and end column will be 129 00:08:19,100 --> 00:08:19,910 in the minus one. 130 00:08:20,630 --> 00:08:21,290 Very simple. 131 00:08:23,080 --> 00:08:29,610 So this is the question, spiral matrix, OK, so the input is basically add to the Matrix and I do 132 00:08:29,620 --> 00:08:30,700 not have to print anything. 133 00:08:30,700 --> 00:08:32,559 I have to return that property just OK. 134 00:08:32,570 --> 00:08:33,100 You can see. 135 00:08:33,340 --> 00:08:37,280 So if this is the matrix, so I have to return that property just OK. 136 00:08:38,530 --> 00:08:42,190 Now, if you have understood the logic now, let's start writing the code. 137 00:08:42,429 --> 00:08:46,280 OK, so as discussed, we need four variables. 138 00:08:46,330 --> 00:08:47,350 OK, start. 139 00:08:47,560 --> 00:08:49,550 OK, so let us first find out the size. 140 00:08:50,000 --> 00:08:52,470 OK, let us first find out size. 141 00:08:52,480 --> 00:08:55,100 So M is basically matrix large size. 142 00:08:55,420 --> 00:08:56,620 How many rules are present. 143 00:08:56,630 --> 00:08:58,450 So it takes the right size. 144 00:08:59,860 --> 00:09:05,950 And similarly, let's find out how many columns had burned, so this will be metrics of zero size. 145 00:09:07,820 --> 00:09:08,390 Simple. 146 00:09:09,360 --> 00:09:12,630 Now, let us construct our answer, so I said above. 147 00:09:12,660 --> 00:09:15,000 OK, so I have this that just. 148 00:09:16,090 --> 00:09:21,660 I said, OK, so I will push every element inside this answer variable, inside this answer vector. 149 00:09:21,800 --> 00:09:28,360 OK, now after finding out the size, I have to take four variables stato which will be zero. 150 00:09:29,850 --> 00:09:32,580 Andrew, so Andrew will be minus one. 151 00:09:33,930 --> 00:09:37,470 And then I have to take basically start column, so start column will be zero. 152 00:09:39,790 --> 00:09:40,930 Start will be zero. 153 00:09:42,090 --> 00:09:45,810 And and so what is and this is and minus one. 154 00:09:45,840 --> 00:09:50,640 OK, so we initialized our variables and I have to also take a count variable. 155 00:09:51,000 --> 00:09:56,410 How many elements has been printed, how many elements has been pushed into this and vector? 156 00:09:56,670 --> 00:09:58,860 So initially this value will be zero. 157 00:09:59,070 --> 00:09:59,460 OK. 158 00:10:01,610 --> 00:10:08,210 Now, let us write our condition so vile, basically, the strato is less than equal to Andrew. 159 00:10:10,330 --> 00:10:14,080 And the START column should be less than articles and column. 160 00:10:14,120 --> 00:10:15,610 OK, very simple condition. 161 00:10:17,510 --> 00:10:23,950 Now, what I have to do so carefully, first of all, I have to print the start, OK, spiral this one. 162 00:10:24,320 --> 00:10:25,600 So this is the spiral order. 163 00:10:26,090 --> 00:10:32,610 So what I have to do, I have to first print the STATO, then I have to print the end column. 164 00:10:32,630 --> 00:10:35,510 OK, so this is step one, step two. 165 00:10:35,780 --> 00:10:42,530 Then I have to print the Andrew third step and then I have to print the start column for step. 166 00:10:42,590 --> 00:10:44,010 OK, so in this order. 167 00:10:44,030 --> 00:10:46,400 So this is step one that does perform step one. 168 00:10:47,540 --> 00:10:47,960 So. 169 00:10:49,650 --> 00:10:55,280 What I have to do, so let's print basically these Estado, OK, I am printing this right. 170 00:10:56,190 --> 00:10:59,580 So for printing this story, I have to read over the columns. 171 00:10:59,580 --> 00:11:00,510 So start column. 172 00:11:01,650 --> 00:11:04,530 I left an article, column and I placeless. 173 00:11:05,900 --> 00:11:07,940 What I have to do is push back. 174 00:11:11,660 --> 00:11:16,280 I thought I'd push back metrics, so this is the metrics, OK, so metrics. 175 00:11:18,790 --> 00:11:22,930 So start row and column is variable again, column is a. 176 00:11:25,030 --> 00:11:31,210 Now, I also have to look closely, OK, because distorting how many elements have been printed. 177 00:11:31,240 --> 00:11:37,660 OK, so after printing the first after printing this through what I have to do, so I have printed the 178 00:11:37,660 --> 00:11:38,010 start. 179 00:11:38,050 --> 00:11:39,430 Also start placeless. 180 00:11:40,120 --> 00:11:44,650 OK, start has been printed, go to the next room and you can also check. 181 00:11:45,220 --> 00:11:51,250 So basically if the value of count, if the value of count become it goes to and in doing. 182 00:11:52,400 --> 00:11:58,010 That means all the elements has been printed, so basically you can written and said, OK, you can 183 00:11:58,010 --> 00:11:58,680 read Nonanswer. 184 00:11:58,940 --> 00:12:00,050 So this is the answer. 185 00:12:01,100 --> 00:12:02,270 You understand the answer. 186 00:12:03,600 --> 00:12:04,680 So step one is done. 187 00:12:04,840 --> 00:12:06,100 OK, so what is it? 188 00:12:06,120 --> 00:12:07,880 Step two, step two is very simple. 189 00:12:08,460 --> 00:12:11,600 This one, I have to print the N column. 190 00:12:11,690 --> 00:12:15,750 OK, I have to print the end column so that print the end column. 191 00:12:19,260 --> 00:12:23,900 So for printing the N column, I have to trade or whether it was OK to start. 192 00:12:25,860 --> 00:12:32,700 I listened very close to Andrew I placeless again to answer dort push back. 193 00:12:34,870 --> 00:12:36,610 But after Russo, metrics of. 194 00:12:37,820 --> 00:12:42,500 So raw is variable, and I have to print the end column, OK, and column. 195 00:12:43,850 --> 00:12:45,890 And again, I have to do count placeless. 196 00:12:47,000 --> 00:12:49,440 So let me read the comments here. 197 00:12:49,480 --> 00:12:53,050 So what I am doing, so second step is printing the end column. 198 00:12:53,100 --> 00:12:54,520 OK, I'm printing the end column. 199 00:12:54,860 --> 00:13:00,890 So after printing the end column, let us go back and column minus minus, OK, and column has been 200 00:13:00,890 --> 00:13:01,330 printed. 201 00:13:01,850 --> 00:13:03,920 And again, I will write this condition. 202 00:13:04,550 --> 00:13:06,530 So if the number of elements. 203 00:13:08,940 --> 00:13:13,500 Is it just women that means all the element has been printed, so in that case, you can read and the 204 00:13:13,500 --> 00:13:15,840 answer I want to say is that we can return our answer. 205 00:13:16,260 --> 00:13:18,720 OK, now the third step, what I have to do. 206 00:13:19,950 --> 00:13:23,030 So this is the third step I have to print the Andrew. 207 00:13:23,070 --> 00:13:24,290 OK, this is the Andrew. 208 00:13:24,300 --> 00:13:25,590 I have to print Andrew. 209 00:13:27,880 --> 00:13:35,440 So I have to print Andrew, so for printing the Andrew, I have to print the road in reverse order. 210 00:13:35,470 --> 00:13:38,530 OK, you can see I have to print the role in this order. 211 00:13:39,400 --> 00:13:43,330 So I will start from and I will stop at start column. 212 00:13:43,360 --> 00:13:48,060 OK, so I have to start at the end column. 213 00:13:49,330 --> 00:13:53,110 I should be bigger than I was to start column A minus minus. 214 00:13:54,540 --> 00:13:57,000 Again, on Sadaat pushback. 215 00:13:59,060 --> 00:13:59,550 Metrics. 216 00:14:00,650 --> 00:14:02,300 So I am printing the Andrew. 217 00:14:04,220 --> 00:14:09,440 And the column will vary, OK, and again, I have to count placeless. 218 00:14:10,620 --> 00:14:16,400 And again, after printing the Andrew, what I have to do, Andrew, minus minus, OK, as I have printed 219 00:14:16,410 --> 00:14:19,350 the Andrew again, we will write the condition. 220 00:14:19,960 --> 00:14:24,420 So if this equals to am in Darwin, that means all the element has been printed. 221 00:14:25,080 --> 00:14:26,430 So you can return the answer. 222 00:14:27,210 --> 00:14:27,560 OK. 223 00:14:28,680 --> 00:14:35,250 Now, our step for step forward is very simple, so I have to print the START column. 224 00:14:35,280 --> 00:14:38,710 OK, I have to print the START column, so I will go from so this is the starter. 225 00:14:38,970 --> 00:14:41,040 I will go from Andrew to start. 226 00:14:41,280 --> 00:14:42,690 OK, from down to up. 227 00:14:44,800 --> 00:14:46,330 So now let us sprint. 228 00:14:47,820 --> 00:14:48,710 The START column. 229 00:14:48,900 --> 00:14:55,530 OK, what I have to do, I have to go from down to up, so I have to go from Andrew, I would start 230 00:14:55,530 --> 00:14:56,100 from Andrew. 231 00:14:56,790 --> 00:14:58,470 I will reach these Dutrow. 232 00:14:59,280 --> 00:15:00,420 I mean, this minus. 233 00:15:00,790 --> 00:15:03,990 OK, now, again, push back. 234 00:15:06,810 --> 00:15:12,750 So what I have to do, so matrix of Rowville very slow is I and I, I'm printing the start column. 235 00:15:14,010 --> 00:15:18,340 And again, I have to count placeless count distorting how many elements has been printed. 236 00:15:18,810 --> 00:15:24,540 So, again, after printing the START column, I will do start column placeless, OK, start column 237 00:15:24,570 --> 00:15:27,120 placeless, and now you can again check. 238 00:15:27,510 --> 00:15:31,860 So if the value of count is basically M&A, then that means all the help has been printed. 239 00:15:32,190 --> 00:15:34,020 So in that case, you can return to your answer. 240 00:15:34,200 --> 00:15:34,590 OK. 241 00:15:35,820 --> 00:15:40,860 So I think we have done everything correctly now for the completion purpose since I have to return the 242 00:15:40,880 --> 00:15:44,700 property just so let us right down out here. 243 00:15:44,760 --> 00:15:47,550 OK, so let us try to answer here also. 244 00:15:47,630 --> 00:15:47,850 OK. 245 00:15:54,710 --> 00:15:56,780 OK, so we did spelling mistakes and we're. 246 00:15:58,380 --> 00:16:00,220 So this will be gone. 247 00:16:00,370 --> 00:16:02,250 OK, now let's now Kuragin. 248 00:16:06,410 --> 00:16:09,800 OK, so our court is looking now us straight to some Hidalgo's OK. 249 00:16:15,430 --> 00:16:18,400 So I have to check basically the Texas MBT. 250 00:16:20,190 --> 00:16:27,060 So basically, M is zero, that means Maddux's, and so in that case, you can return Ambrosiano said, 251 00:16:27,060 --> 00:16:27,310 OK. 252 00:16:27,330 --> 00:16:31,620 So at this point, so this answer is empty, OK, if he will run again. 253 00:16:34,060 --> 00:16:38,590 OK, so our goal is working fine, otherwise you can also write one more condition. 254 00:16:39,290 --> 00:16:44,230 So if the number of columns are zero, then also you can return the empty answer. 255 00:16:44,290 --> 00:16:44,650 OK. 256 00:16:46,060 --> 00:16:46,890 Now, that summit. 257 00:16:52,110 --> 00:16:56,700 OK, so our court is working fine now let us discuss the time and the space complexity. 258 00:16:57,660 --> 00:17:00,420 OK, so now let's discuss the time and the space complexity. 259 00:17:01,670 --> 00:17:09,200 So, again, the space complexity is basically order, one space complexity is outdraw when we are not 260 00:17:09,200 --> 00:17:13,290 allocating, we are not creating any stars, we are not taking any extra space. 261 00:17:13,640 --> 00:17:18,109 So space is basically ultrafine and time complexity is basically order of emon. 262 00:17:20,200 --> 00:17:25,210 OK, we are going through each and every element of the metrics we are going through each and every 263 00:17:25,230 --> 00:17:25,599 element of the. 264 00:17:26,000 --> 00:17:30,710 So that's why the time, complexities and the number of rules and the number of columns. 265 00:17:30,780 --> 00:17:35,460 OK, so it is very simple logic, OK, a very simple implementation problem. 266 00:17:36,040 --> 00:17:37,450 I am predicting the start. 267 00:17:37,930 --> 00:17:44,250 So this is the first step into this rule, then starts to print the end column. 268 00:17:44,470 --> 00:17:46,080 So I'm printing the end column. 269 00:17:46,120 --> 00:17:49,060 Step two then I'm doing and column minus minus. 270 00:17:49,360 --> 00:17:50,680 Then I'm printing the end. 271 00:17:50,950 --> 00:17:57,400 So I am printing the intruders step three then I did and minus minus then I am printing the start column. 272 00:17:57,610 --> 00:18:02,710 So this is step print at the start column and then here I have written start column plus plus. 273 00:18:02,980 --> 00:18:03,790 So what will happen. 274 00:18:04,360 --> 00:18:06,010 This will be my new matrix. 275 00:18:07,290 --> 00:18:13,170 Again, I will step one, I will do step two, I will do step three, I will do step forward. 276 00:18:13,420 --> 00:18:15,420 OK, so very, very simple logic. 277 00:18:16,080 --> 00:18:20,520 OK, so this is step when the first step to this is step three and this is step four. 278 00:18:21,820 --> 00:18:26,440 OK, time and the space complexities, big government and big often. 279 00:18:26,500 --> 00:18:30,220 OK, so if you have any doubt in this question, you can ask me, OK, thank you.