1 00:00:02,029 --> 00:00:02,719 Hi, everyone. 2 00:00:02,750 --> 00:00:09,090 So in this video, we are going to write the code for this function, Belpre, so you can see the input 3 00:00:09,110 --> 00:00:15,410 is preorder traversal and traversal, but if you will see our function, so we are doing something like 4 00:00:15,410 --> 00:00:19,200 this, we will create a function and we will give you another traversal period. 5 00:00:19,640 --> 00:00:22,660 And we also give these four values simple. 6 00:00:22,850 --> 00:00:25,190 So first, let's create a helper function. 7 00:00:27,950 --> 00:00:29,720 So I want to create a helper function. 8 00:00:30,600 --> 00:00:31,470 It will return. 9 00:00:33,930 --> 00:00:36,960 So let's say the name of the tree is built tree helper. 10 00:00:38,560 --> 00:00:45,110 It will return the root of the tree, so Belpre helper function and what it will take. 11 00:00:45,790 --> 00:00:52,000 So it will take a period reversal in order to start in order and start preordering for constructing 12 00:00:52,000 --> 00:00:52,370 the tree. 13 00:00:53,020 --> 00:00:57,940 So I need a vector of indigenous. 14 00:00:59,120 --> 00:01:00,310 So this is an ordered. 15 00:01:03,650 --> 00:01:05,990 I need another vector for preorder. 16 00:01:12,240 --> 00:01:14,160 So that area three already. 17 00:01:15,820 --> 00:01:20,350 And if you will see in order starting or that end, preorder, start preordering. 18 00:01:21,950 --> 00:01:26,780 So I need India in order to start. 19 00:01:29,980 --> 00:01:35,410 Integer in order and I need preorder. 20 00:01:39,440 --> 00:01:40,790 So this is pretty early start. 21 00:01:42,110 --> 00:01:43,490 And Fiordland. 22 00:01:44,390 --> 00:01:45,320 Preorder and. 23 00:01:47,610 --> 00:01:51,280 And we will write this function, so it is taking a lot of variables. 24 00:01:51,600 --> 00:01:54,570 So if you want, you can short their names also. 25 00:01:54,570 --> 00:01:57,180 So the names are very big, so let's name it. 26 00:01:58,400 --> 00:02:00,380 In start, so this is in order to start. 27 00:02:02,320 --> 00:02:07,120 This is in order to end, and this is preorders start. 28 00:02:10,250 --> 00:02:11,780 This is preorder and. 29 00:02:16,030 --> 00:02:16,780 So let's. 30 00:02:17,910 --> 00:02:24,060 So instead of start, we can also write as in order to start, this is in order and. 31 00:02:26,490 --> 00:02:31,410 This is Preordering Start, and finally, this is. 32 00:02:33,680 --> 00:02:41,090 So this is preorder, and so now it's looking good, so I am digging in already. 33 00:02:41,120 --> 00:02:46,640 I am taking preorder as input and start in order and really start own. 34 00:02:47,950 --> 00:02:51,510 So we know we know dysfunction. 35 00:02:51,550 --> 00:02:52,670 So what is our approach? 36 00:02:53,560 --> 00:02:55,230 Our approach is very simple. 37 00:02:55,960 --> 00:02:58,970 We will construct the root node, so I am writing it here. 38 00:03:00,520 --> 00:03:01,920 So our approach is very simple. 39 00:03:01,930 --> 00:03:05,950 I will construct the root node and then I will call the function. 40 00:03:05,950 --> 00:03:08,080 I recall the occasion for building the left subtree. 41 00:03:08,350 --> 00:03:14,350 I will call occasion for building the right subtree and I will construct a node and general construct 42 00:03:14,350 --> 00:03:16,120 these two separate simple. 43 00:03:16,450 --> 00:03:19,150 So for root node, what do we need? 44 00:03:19,570 --> 00:03:21,170 So just remember the order. 45 00:03:21,220 --> 00:03:22,090 What is preorder. 46 00:03:23,160 --> 00:03:27,770 The order is first, you print the root node, then you print the live separate, so first you print 47 00:03:27,770 --> 00:03:34,310 the root node, then you print the left subtree and then you print the right subtree. 48 00:03:35,990 --> 00:03:37,210 And what is in order? 49 00:03:39,860 --> 00:03:47,810 And all that is left to right, so first you print the left subtree, then you print the root node and 50 00:03:47,810 --> 00:03:49,730 then you print that out simply. 51 00:03:53,080 --> 00:03:55,420 So let's construct the route, not first. 52 00:04:01,540 --> 00:04:06,040 So I want to construct the note, and it is basically this index, the first index. 53 00:04:06,970 --> 00:04:11,950 So since this function is going to be recursive function, so first of all, we need to be able to write 54 00:04:11,950 --> 00:04:15,280 the code for the base case and what is the base case ampitheater. 55 00:04:15,580 --> 00:04:21,070 So for an area in order to start will be greater than in order end. 56 00:04:21,760 --> 00:04:24,760 Or you can also write like this, you are preorder. 57 00:04:24,760 --> 00:04:29,690 Start will be greater than preorder and so you can use any of them. 58 00:04:29,710 --> 00:04:32,620 So, for example, I'm using an order starting ordering. 59 00:04:32,680 --> 00:04:33,850 So this is the best case. 60 00:04:34,450 --> 00:04:36,770 This case means your area is empty. 61 00:04:37,030 --> 00:04:42,040 So for Empty-headed, which would be a tree, so your tree will be null, right for them. 62 00:04:42,040 --> 00:04:44,520 Pertierra The output will be empty. 63 00:04:44,800 --> 00:04:45,970 So I am returning them. 64 00:04:48,330 --> 00:04:50,940 So now let's discuss about the raw data. 65 00:04:50,970 --> 00:04:52,560 So what is the raw data? 66 00:04:53,670 --> 00:04:55,320 So raw data. 67 00:04:56,600 --> 00:05:02,060 It's basically the first element, so this is the reversal traversal, so the first element. 68 00:05:03,120 --> 00:05:04,090 So let's copy this. 69 00:05:04,950 --> 00:05:08,310 So the first element of deputed traversal is going to be my route. 70 00:05:08,730 --> 00:05:09,430 So zero. 71 00:05:09,720 --> 00:05:10,570 No, this is wrong. 72 00:05:10,590 --> 00:05:13,560 You cannot write zero because you are using recursion. 73 00:05:13,770 --> 00:05:15,420 So this is your start. 74 00:05:16,260 --> 00:05:18,920 So basically, this index is not zero. 75 00:05:18,930 --> 00:05:19,860 You will not zero. 76 00:05:19,860 --> 00:05:21,340 You will write preorder start. 77 00:05:21,630 --> 00:05:23,760 So this index is preorder start. 78 00:05:24,090 --> 00:05:25,610 You are passing preorders start. 79 00:05:25,620 --> 00:05:27,390 Remember, you are passing your Nasrat. 80 00:05:28,380 --> 00:05:31,780 So writing zero will be wrong, so zero writing zero will be wrong. 81 00:05:32,850 --> 00:05:34,830 So this is a start. 82 00:05:34,860 --> 00:05:36,360 So this is your start. 83 00:05:38,880 --> 00:05:41,700 So let's cooperate here, but start. 84 00:05:43,780 --> 00:05:45,590 So now we know what is the raw data. 85 00:05:46,300 --> 00:05:50,530 So what we need to do, we need to find out this year the values. 86 00:05:51,250 --> 00:05:52,240 We need to find out. 87 00:05:53,650 --> 00:05:55,510 We need to find out the earth values. 88 00:05:58,220 --> 00:06:06,620 What are the values left in order to start left in order and right, left, right, left and right, 89 00:06:06,620 --> 00:06:13,520 preorder, start, right, preorder and left in order to start, left in order and right in order to 90 00:06:13,520 --> 00:06:14,590 start right in order. 91 00:06:14,600 --> 00:06:18,830 And so we need to find out eight values so that I can construct the left and the right subtree. 92 00:06:19,340 --> 00:06:21,470 So let's see how we can do that. 93 00:06:24,670 --> 00:06:29,050 So I need left in order to start. 94 00:06:30,890 --> 00:06:35,150 I need left in order and. 95 00:06:37,420 --> 00:06:40,270 I need to find out left. 96 00:06:42,920 --> 00:06:43,550 Preorder. 97 00:06:44,690 --> 00:06:46,850 So left before the start. 98 00:06:49,600 --> 00:06:52,270 Left the end. 99 00:06:54,260 --> 00:06:58,540 And similarly, these four values for the rights are also for calling on the right pray. 100 00:06:59,060 --> 00:06:59,930 So I need. 101 00:07:02,570 --> 00:07:03,170 Right. 102 00:07:04,330 --> 00:07:05,530 In order to start. 103 00:07:06,850 --> 00:07:10,330 I need a ride in order and. 104 00:07:13,720 --> 00:07:14,380 Similarly. 105 00:07:16,250 --> 00:07:17,510 I need right. 106 00:07:19,930 --> 00:07:20,920 Order start. 107 00:07:22,090 --> 00:07:22,720 I need. 108 00:07:24,120 --> 00:07:24,680 Right. 109 00:07:25,560 --> 00:07:31,390 Pre order, and so we need to find out all these great values, so after calculating all these great 110 00:07:31,410 --> 00:07:33,620 values, what we need to do, we have the raw data. 111 00:07:34,170 --> 00:07:36,050 So as discussed, what is our plan? 112 00:07:36,270 --> 00:07:41,670 Our plan is first to construct the root node and then call that equation for the left separate and call 113 00:07:41,670 --> 00:07:42,950 that equation for the right supply. 114 00:07:43,290 --> 00:07:45,390 So let us construct the root node. 115 00:07:46,420 --> 00:07:51,190 So we have the raw data, we have this raw data, we can construct the node, so three. 116 00:07:53,050 --> 00:08:01,570 North Star route is New Reinold and will pass that data. 117 00:08:07,910 --> 00:08:13,400 So now our first step is done, we have constructed the route note and now let's call that a question 118 00:08:13,400 --> 00:08:15,280 for the left and right separate. 119 00:08:16,940 --> 00:08:18,440 So we need to call the recursion. 120 00:08:22,770 --> 00:08:30,060 So what is I want to construct the left of route, so we will call this function for constructing the 121 00:08:31,290 --> 00:08:32,549 so called function. 122 00:08:33,610 --> 00:08:35,010 It takes in order to sell. 123 00:08:35,740 --> 00:08:37,210 So let's give order traversal. 124 00:08:40,220 --> 00:08:41,929 It takes traversal. 125 00:08:42,929 --> 00:08:44,450 So let's give traversal. 126 00:08:46,600 --> 00:08:51,580 Now it needs in order to start, so I'm calling on left, so I will give left in order to start. 127 00:08:56,030 --> 00:09:00,050 So then it needs in order, and so I have left in order and. 128 00:09:05,040 --> 00:09:10,230 Then it needs to start and build and so I am calling on left, so left to preorder start. 129 00:09:12,630 --> 00:09:14,820 And this is left preorder and. 130 00:09:19,340 --> 00:09:20,100 Simple, right? 131 00:09:20,300 --> 00:09:26,660 So now you're left has been constructed and now what we will do so after the left subtree has been constructed. 132 00:09:26,700 --> 00:09:28,880 Now let us also construct our rights free. 133 00:09:31,360 --> 00:09:38,490 So now I want to construct my rights apprec, which is, again, I will call this function military 134 00:09:38,590 --> 00:09:41,170 helper, it will construct my right subtree. 135 00:09:41,440 --> 00:09:43,090 So I need in order traversal. 136 00:09:46,230 --> 00:09:48,150 I also need burette traversal. 137 00:09:52,890 --> 00:10:01,110 So it is asking for in order to start, since I'm calling on rightly so, I will give right in order 138 00:10:01,110 --> 00:10:01,530 to start. 139 00:10:02,600 --> 00:10:06,860 Then it needs in order, and so I will give right in order to end. 140 00:10:10,190 --> 00:10:15,380 Then it needs to start and be all around since I'm calling on the right subtree, so I will give right 141 00:10:15,380 --> 00:10:16,130 before the start. 142 00:10:18,990 --> 00:10:21,630 And I will give right preorder and. 143 00:10:25,140 --> 00:10:32,610 Simple, so now our rights are free, so our complete tree has been constructed, we constructed the 144 00:10:32,610 --> 00:10:38,280 root ourselves here, then the equation we call occasion for the tree has been constructed. 145 00:10:38,550 --> 00:10:40,200 We call the occasion for the right pray. 146 00:10:40,410 --> 00:10:46,650 You can see we are calling the occasion for left subtree and for iSuppli and we are teaching them. 147 00:10:46,650 --> 00:10:51,360 So this connection has been established, this connection has been established and now we will return 148 00:10:51,360 --> 00:10:51,680 the rule. 149 00:10:51,870 --> 00:10:54,210 Since our tree is ready, we will return the road. 150 00:10:55,170 --> 00:11:01,950 So after constructing the entire tree, I will return the road and how I will call this function. 151 00:11:03,540 --> 00:11:06,370 So I will call the function tree helper. 152 00:11:06,390 --> 00:11:12,630 So first, let's find out what is the total number of elements so you can do in order their size. 153 00:11:14,300 --> 00:11:19,380 So you can do in order size or you can look the number of elements is going to be seen, right? 154 00:11:20,330 --> 00:11:23,720 So after finding out the size, I will call this function helper. 155 00:11:26,160 --> 00:11:32,030 So I want to return the root node, so return Belpre helper it takes in order. 156 00:11:32,820 --> 00:11:34,530 So I will give this in to. 157 00:11:38,170 --> 00:11:39,680 Then it takes preordering. 158 00:11:39,700 --> 00:11:41,230 So this is my priority. 159 00:11:44,880 --> 00:11:50,190 Then it takes in order to start in order, and so in order to start zero, I have to give them in order 160 00:11:50,190 --> 00:11:58,380 to start from zero and the end indexes and minus one Briona, start from zero order and at index and 161 00:11:58,380 --> 00:11:58,950 minus one. 162 00:12:00,060 --> 00:12:06,030 So now everything is complete, so we have the majority of the time, so what we need to do. 163 00:12:07,430 --> 00:12:14,540 So our goal is our goal will work, we just need to find out these eight values, if we will find out 164 00:12:14,540 --> 00:12:18,290 these eight values correctly, then our entire code will work. 165 00:12:18,650 --> 00:12:22,330 So we will find out these eight values in our last session. 166 00:12:22,610 --> 00:12:24,750 So let's find out them again. 167 00:12:24,770 --> 00:12:28,240 So the main problem, so this is basically a mathematical problem. 168 00:12:28,250 --> 00:12:29,480 This is not a difficult problem. 169 00:12:30,200 --> 00:12:33,620 The difficult part is finding out these eight values correctly. 170 00:12:33,830 --> 00:12:37,940 So first, let's start filling those values, which are very obvious. 171 00:12:38,700 --> 00:12:43,740 Let's start feeling the values which are obvious so left in order to start. 172 00:12:44,840 --> 00:12:47,950 So see, this is what is left in order to start. 173 00:12:47,960 --> 00:12:50,310 This is the same as preorder start. 174 00:12:50,450 --> 00:12:52,760 So let's fill this value because it is very obvious. 175 00:12:53,090 --> 00:12:57,110 So this is same as, OK, so I did one mistake. 176 00:12:57,120 --> 00:12:58,160 This is not preorder. 177 00:12:58,170 --> 00:12:59,240 This is in order to start. 178 00:13:00,210 --> 00:13:03,240 In order to start your day start. 179 00:13:04,290 --> 00:13:08,540 This is Reporter End and this is in order. 180 00:13:08,590 --> 00:13:11,600 And so first, let us fill all these values. 181 00:13:12,060 --> 00:13:15,040 So in order to start left, in order to start. 182 00:13:15,060 --> 00:13:17,710 So left in our last are the same as in order to start. 183 00:13:18,210 --> 00:13:19,470 So this is in order to start. 184 00:13:23,710 --> 00:13:29,410 OK, so left in order and now left in order, it is difficult right now, left to start. 185 00:13:30,450 --> 00:13:33,790 So preorders start left is very simple, you just need. 186 00:13:34,350 --> 00:13:35,590 So this is also very simple. 187 00:13:35,640 --> 00:13:39,860 This is so what is left preorder start. 188 00:13:40,200 --> 00:13:42,630 So this is preorder and this is the starting point. 189 00:13:42,660 --> 00:13:46,840 So that means the preorders start plus one simple. 190 00:13:47,430 --> 00:13:49,770 So this is preorders start. 191 00:13:51,830 --> 00:13:52,400 Plus one. 192 00:13:54,190 --> 00:14:03,380 A start plus one, what is left preorder and so preorder left and right now, that's difficult to calculate. 193 00:14:03,640 --> 00:14:06,590 So let's discuss about right in order to start. 194 00:14:07,300 --> 00:14:08,950 So in order area and right. 195 00:14:09,340 --> 00:14:12,670 So right now it is also difficult, right. 196 00:14:12,670 --> 00:14:15,700 In order and so right in order. 197 00:14:15,700 --> 00:14:16,030 Right. 198 00:14:16,030 --> 00:14:19,720 And so the system is right in order and is the same as in order. 199 00:14:19,810 --> 00:14:22,570 And so this is the right in order and at the same as in order. 200 00:14:22,600 --> 00:14:24,280 And so let's fill this value. 201 00:14:24,790 --> 00:14:26,320 So in order and. 202 00:14:32,520 --> 00:14:39,900 Right, preorder, start, so preorder and right to start, we don't know, right preorder and so right 203 00:14:39,900 --> 00:14:42,000 before the end is same as preorder preordering. 204 00:14:42,120 --> 00:14:43,540 So this one is also very easy. 205 00:14:44,160 --> 00:14:46,980 So this is same as preorder and. 206 00:14:51,240 --> 00:14:58,680 So now what is the situation so we have calculated for values very easily, so disvalue then Disvalue 207 00:14:58,680 --> 00:15:00,710 done this done and is done. 208 00:15:01,260 --> 00:15:04,610 We have calculated for values and we need to calculate for more. 209 00:15:04,620 --> 00:15:06,180 So let's see how we will do that. 210 00:15:08,410 --> 00:15:13,750 So let's discuss about this value left in order and. 211 00:15:14,850 --> 00:15:19,590 This is the left in order and we need to find out the index of this element. 212 00:15:20,220 --> 00:15:22,830 So, you know the root element. 213 00:15:23,640 --> 00:15:24,620 We know the root element. 214 00:15:24,630 --> 00:15:25,700 So we have the raw data. 215 00:15:25,750 --> 00:15:29,200 What we will do, we will search for root in the traversal. 216 00:15:29,700 --> 00:15:30,840 We will use a for loop. 217 00:15:30,990 --> 00:15:31,980 We will search for the root. 218 00:15:32,250 --> 00:15:35,540 You will find out the root by finding out the root. 219 00:15:35,550 --> 00:15:38,140 I mean, you will be able to find out the index. 220 00:15:38,160 --> 00:15:40,490 So let's call it a root index. 221 00:15:41,430 --> 00:15:42,610 And what does this value? 222 00:15:42,630 --> 00:15:45,370 This values root index minus one simple. 223 00:15:46,260 --> 00:15:52,150 So this value is the same as root index, minus one. 224 00:15:52,410 --> 00:15:55,980 But first you need to find out what is root and so forth, finding out the truth. 225 00:15:56,020 --> 00:15:59,490 Next, you need to ETrade already in order at a solid let's rate. 226 00:16:03,690 --> 00:16:05,950 So let's try to find out the root index. 227 00:16:08,640 --> 00:16:16,860 Let's see, the value of rootlets is minus one and let's find out the next four and. 228 00:16:18,120 --> 00:16:20,700 I equals in order to start. 229 00:16:21,750 --> 00:16:26,310 So this is the start when I did over the Internet, so in order to start. 230 00:16:28,110 --> 00:16:33,150 I didn't know what it was to in order, and I placeless. 231 00:16:35,140 --> 00:16:40,690 So if the order, Eddie, so if the order, Eddie. 232 00:16:43,860 --> 00:16:56,010 Ofay is same as the raw data, then we find out our next so rude index is basically a and then we will 233 00:16:56,010 --> 00:16:56,400 break. 234 00:16:59,500 --> 00:17:06,460 So now when we will come out of this whole loop, so when we will come out of this for loop, we know 235 00:17:06,730 --> 00:17:10,500 the routine, so we know the index of this element. 236 00:17:10,780 --> 00:17:16,079 So left, so left in order and is just rude index minus one. 237 00:17:16,089 --> 00:17:19,329 So we know the value this values root index minus one. 238 00:17:19,930 --> 00:17:26,710 So is it possible that after coming out of this value the value of the Nexus minus one, so it is only 239 00:17:26,710 --> 00:17:29,000 possible in case the input is wrong. 240 00:17:29,620 --> 00:17:31,890 So here the value of the index is minus one. 241 00:17:32,050 --> 00:17:36,810 If the values minus one, that means your input is wrong, your input is wrong. 242 00:17:37,000 --> 00:17:37,900 And one more thing. 243 00:17:38,200 --> 00:17:41,350 Our code will only work if there are no duplicates. 244 00:17:41,350 --> 00:17:44,360 So we are assuming there are no duplicates in the adding. 245 00:17:46,040 --> 00:17:51,890 For example, if this new test for this, it is also food and we have food multiple times, for example, 246 00:17:51,890 --> 00:17:53,660 food is also here for is also here. 247 00:17:53,960 --> 00:17:55,150 Albacore will not look. 248 00:17:55,430 --> 00:17:59,820 So we are assuming no duplicates and input is also right. 249 00:17:59,840 --> 00:18:02,630 So our Rouda next will not be minus one. 250 00:18:04,510 --> 00:18:06,490 So we do not have to overreact all these things. 251 00:18:13,530 --> 00:18:19,380 So now we know what is left in order, and so this is routine X minus one. 252 00:18:21,340 --> 00:18:22,300 So the next. 253 00:18:23,270 --> 00:18:23,960 Minus one. 254 00:18:24,950 --> 00:18:27,290 OK, what is left pre order and. 255 00:18:29,110 --> 00:18:35,500 So this value is a little difficult to calculate, so we need to find out this value and I told you 256 00:18:35,650 --> 00:18:39,050 so, the number of elements in the left will be the same. 257 00:18:39,940 --> 00:18:45,190 So these elements so these number of elements and these number of elements will be. 258 00:18:45,760 --> 00:18:53,290 So we can use a condition like left in order and minus left in order to start. 259 00:18:53,440 --> 00:19:00,940 So these are the number of elements is same as left preorder and minus left start. 260 00:19:01,150 --> 00:19:02,520 So we need to find out this value. 261 00:19:02,530 --> 00:19:04,300 We need to find out this value. 262 00:19:04,300 --> 00:19:05,820 And we already have three values. 263 00:19:06,430 --> 00:19:09,800 So let's find out this value. 264 00:19:09,830 --> 00:19:12,160 So this values the same as we can do. 265 00:19:13,030 --> 00:19:15,350 So we move this to the left hand side. 266 00:19:15,790 --> 00:19:17,720 So this is left. 267 00:19:17,740 --> 00:19:18,520 Preorders start. 268 00:19:21,670 --> 00:19:22,660 Left before the start. 269 00:19:23,590 --> 00:19:24,850 So left preorders start. 270 00:19:26,550 --> 00:19:30,000 Plus, left in order and so left in order to end. 271 00:19:34,230 --> 00:19:37,950 Minus left in order to start left in order to start. 272 00:19:41,010 --> 00:19:41,800 Simple, right? 273 00:19:42,030 --> 00:19:44,820 So now we have also calculated this value. 274 00:19:47,200 --> 00:19:54,250 So now let's discuss about how we can calculate, right, in order to start so right in order to start. 275 00:19:54,280 --> 00:19:58,940 So in order to do so, in order to sell and this is the starting. 276 00:19:58,960 --> 00:20:01,720 So what is starting RWD index plus one? 277 00:20:02,470 --> 00:20:03,610 So this is also simple. 278 00:20:04,480 --> 00:20:05,800 So this is basically. 279 00:20:09,560 --> 00:20:11,720 The next plus one. 280 00:20:13,150 --> 00:20:19,260 We already calculated right in order and and this is the last remaining value, right, the start, 281 00:20:20,290 --> 00:20:25,440 so we need to find out pre order and right before the start. 282 00:20:25,450 --> 00:20:25,810 So. 283 00:20:26,140 --> 00:20:26,680 Right. 284 00:20:26,680 --> 00:20:27,800 And preorders start. 285 00:20:28,390 --> 00:20:29,560 So we're desperate to start. 286 00:20:29,560 --> 00:20:30,780 We can redeem this value. 287 00:20:30,910 --> 00:20:34,930 So Disvalue plus one and this is left pre order end. 288 00:20:34,980 --> 00:20:38,400 OK, so this is this is left before the end and plus one. 289 00:20:38,650 --> 00:20:40,420 So this value plus one. 290 00:20:42,420 --> 00:20:44,640 So copy this value left, preorder end. 291 00:20:47,040 --> 00:20:53,250 So this value plus one, so now I think we have calculated all our values correctly. 292 00:20:56,060 --> 00:21:02,180 So now I think we have calculated all our values correctly and our culture work fine now, so let's 293 00:21:02,180 --> 00:21:04,920 try to test our gold and learn more everything. 294 00:21:05,570 --> 00:21:08,660 So let's first we will run our code and then we will submit. 295 00:21:12,380 --> 00:21:14,110 OK, so now you're something called. 296 00:21:18,220 --> 00:21:22,190 So basically, our solution got accepted, so our solution is a hundred percent correct. 297 00:21:22,720 --> 00:21:25,710 So basically, what is the most difficult part of this problem? 298 00:21:25,990 --> 00:21:31,540 So the most difficult part of solving this problem is to just find out these values correctly. 299 00:21:32,230 --> 00:21:36,040 So if you will find out these eight values correctly, then this problem is very easy. 300 00:21:36,550 --> 00:21:38,380 So this is basically a math problem. 301 00:21:39,470 --> 00:21:44,980 A simple, OK, just logical, there's nothing much complicated here, just find out all these values 302 00:21:44,990 --> 00:21:48,300 step by step and you will be able to find out everything. 303 00:21:49,160 --> 00:21:50,560 So this is it from this video. 304 00:21:51,230 --> 00:21:52,520 I will see you in the next one.