1 00:00:01,890 --> 00:00:02,610 Hi, everyone. 2 00:00:02,640 --> 00:00:06,360 So in the last video, we discussed this question, find the diameter of a binary. 3 00:00:06,660 --> 00:00:12,160 So in this video, we want to discuss a better approach, better approach in terms of time, complexity. 4 00:00:12,600 --> 00:00:15,630 So this is how we will utilize our resources. 5 00:00:16,820 --> 00:00:20,400 This is the left subtree and this is the right Sabry. 6 00:00:21,780 --> 00:00:27,480 So what will do so rude will ask the left, hey, find out the height and the diameter. 7 00:00:27,780 --> 00:00:31,570 Solarcentury will determine its height and it will dondi diameter. 8 00:00:31,920 --> 00:00:33,830 Now Ruth will call on the right subtree. 9 00:00:33,840 --> 00:00:34,350 Hey, right. 10 00:00:34,740 --> 00:00:36,340 Find out your height and diameter. 11 00:00:36,540 --> 00:00:42,460 So I have probably done the height and the diameter so we know what is left, right and left diameter. 12 00:00:42,480 --> 00:00:44,930 We know what is right height and right diameter. 13 00:00:45,120 --> 00:00:47,760 So can we find out overall height and overall diameter? 14 00:00:47,970 --> 00:00:49,600 So what will be the overall height? 15 00:00:50,370 --> 00:00:54,930 So overall height will be one plus maximum of left and right. 16 00:00:54,930 --> 00:00:55,170 Right. 17 00:00:55,410 --> 00:00:59,530 So this will be one plus maximum of left and right. 18 00:00:59,580 --> 00:00:59,820 Right. 19 00:01:00,930 --> 00:01:03,360 And can we find out what is the overall diameter? 20 00:01:03,780 --> 00:01:05,730 So overall diameter will be. 21 00:01:06,150 --> 00:01:07,270 So I have three options. 22 00:01:07,530 --> 00:01:12,550 So I take maximum of what is the first option left out plus right. 23 00:01:13,170 --> 00:01:14,700 So first option is left out. 24 00:01:14,700 --> 00:01:15,390 Plus right eight. 25 00:01:15,630 --> 00:01:17,670 Second option is left diameter. 26 00:01:19,140 --> 00:01:20,910 Third option is Radiometer. 27 00:01:23,060 --> 00:01:29,840 So we can find out the overnight and we can find out the overall diameter, so root will return overnight 28 00:01:29,840 --> 00:01:31,930 and overall diameter simple. 29 00:01:32,120 --> 00:01:33,440 So that is our approach. 30 00:01:33,470 --> 00:01:35,720 So first, let's discuss the base case. 31 00:01:37,870 --> 00:01:43,100 So case will be traditional, so if Rudisill is the first step. 32 00:01:43,120 --> 00:01:50,710 So if traditional, but without zero vertical diameter to zero, now the second step is basically hypothesis 33 00:01:50,710 --> 00:01:52,060 step or the induction step. 34 00:01:52,390 --> 00:01:59,860 So in this step, we will be able to find out the left, right, left, diameter, right out and right 35 00:01:59,880 --> 00:02:00,400 diameter. 36 00:02:01,210 --> 00:02:02,460 And what is the third step? 37 00:02:03,160 --> 00:02:08,620 So third step is basically finding out the overall height and diameter and the steps or this step is 38 00:02:08,620 --> 00:02:12,540 basically the third step, finding the overall height and the overall diameter. 39 00:02:13,840 --> 00:02:20,230 So what we want to do, so we want to return to things, I want to return to things so we can create 40 00:02:20,230 --> 00:02:20,710 a class. 41 00:02:22,060 --> 00:02:26,710 So I want to return a pair of these two things so I can go to class, Gaspare. 42 00:02:28,240 --> 00:02:32,470 First will be debate in Detroit, and second thing is Daym. 43 00:02:33,700 --> 00:02:39,100 So I know what the function will be up here, and let's say the name of the function is find out the 44 00:02:39,100 --> 00:02:44,410 height and the diameter, it will take root as input and it will return dippie. 45 00:02:45,550 --> 00:02:52,690 So it will be done up here and it has two things height and the diameter, or if you want to make the 46 00:02:52,690 --> 00:02:57,490 call for the generic so I can create glass like this glassware. 47 00:02:57,520 --> 00:03:01,420 So instead of this height and diameter, I will call it first and second. 48 00:03:02,790 --> 00:03:06,740 I am calling it first, I am calling Dimetapp Second. 49 00:03:08,010 --> 00:03:12,780 So if you want to make the class, if you want to make the class of beer generic so you can do also 50 00:03:12,780 --> 00:03:19,060 like this in first and second, but there is no need to do all this thing because we have Invicta per 51 00:03:19,080 --> 00:03:19,530 class. 52 00:03:21,590 --> 00:03:27,560 So we have inbuilt Berglas in C++ and this class has implemented using template. 53 00:03:29,520 --> 00:03:35,280 So this is the code for the Beltway class, so instead of integer first, it is the first and similarly 54 00:03:35,280 --> 00:03:40,320 it is B second, and then you will create the object of this class. 55 00:03:40,320 --> 00:03:42,760 You will give the value of t, you will give the value of. 56 00:03:44,130 --> 00:03:45,270 So let's write the code. 57 00:03:47,860 --> 00:03:53,110 So this is our previous quote, let's find out everything or let's reset our good. 58 00:03:55,220 --> 00:03:59,090 So I'm resetting my code, so what I want to do. 59 00:04:01,400 --> 00:04:06,440 They don't have the function will be their superiors and world class and C++, since it is implemented 60 00:04:06,440 --> 00:04:07,130 using template. 61 00:04:07,730 --> 00:04:10,340 So the first value height is going to be integer. 62 00:04:10,770 --> 00:04:13,430 The second value diameter is also integer. 63 00:04:14,210 --> 00:04:16,760 And let's say the name of the function is height diameter. 64 00:04:20,390 --> 00:04:22,280 The name of the function is higher diameter. 65 00:04:23,190 --> 00:04:24,150 So it will take. 66 00:04:25,650 --> 00:04:26,040 Input. 67 00:04:28,540 --> 00:04:30,080 And it will be done up here. 68 00:04:30,370 --> 00:04:33,570 And finally, what we will do so here, we will call this function. 69 00:04:34,480 --> 00:04:35,670 So let's call this function. 70 00:04:35,680 --> 00:04:36,370 Hi, Daym. 71 00:04:40,270 --> 00:04:42,220 We will pass it, Ruth. 72 00:04:43,380 --> 00:04:47,070 So dysfunction and it does appear so let's create a period. 73 00:04:48,700 --> 00:04:52,540 Fear of indigenous communities are heightened diameter, let's name it be. 74 00:04:54,570 --> 00:05:00,060 And what we need to return, so we need to return integer and I want to return diameter. 75 00:05:00,240 --> 00:05:01,350 So what is diameter? 76 00:05:01,380 --> 00:05:02,710 Diameter is the second value. 77 00:05:03,300 --> 00:05:05,240 So I am assuming they do this second. 78 00:05:05,250 --> 00:05:06,930 So I will write P Dot. 79 00:05:07,970 --> 00:05:08,510 Second. 80 00:05:12,880 --> 00:05:18,790 So what I'm doing here, so I'm calling this function Dimitar, I'm giving your route so this function 81 00:05:19,480 --> 00:05:23,650 will return me what is the height of my tree and what is the diameter of my tree? 82 00:05:23,890 --> 00:05:26,020 So it is a stunning integer integer. 83 00:05:26,200 --> 00:05:34,210 So this is an multiclass Glaspie integer first and indeed second. 84 00:05:36,970 --> 00:05:42,240 So why integer, because you are giving Integer an advantage, because you are giving integer and what 85 00:05:42,260 --> 00:05:42,830 you need to do. 86 00:05:43,030 --> 00:05:49,540 So I'm assuming first is right and second is diameter, and this function returns are daym, so I am 87 00:05:49,540 --> 00:05:50,880 returning Bédard second. 88 00:05:50,890 --> 00:05:55,670 So I am returning the diameter value and now we need to write the code for this function. 89 00:05:55,930 --> 00:05:57,040 So let's write the code. 90 00:05:59,370 --> 00:06:01,560 So basically, if traditional. 91 00:06:06,360 --> 00:06:11,580 So if traditional, my height will be zero, my diameter will be zero, and I need to return a pair. 92 00:06:12,510 --> 00:06:13,800 So let's create a pair. 93 00:06:15,000 --> 00:06:16,320 Fear of contagion combined. 94 00:06:16,950 --> 00:06:21,900 Let's name it be so what out first with our first sight, Heidi? 95 00:06:21,930 --> 00:06:22,320 Zero. 96 00:06:23,300 --> 00:06:32,210 What is that second winner is diameter, diameter, zero, and then you can be so then we are turning 97 00:06:32,210 --> 00:06:32,720 up here. 98 00:06:34,510 --> 00:06:36,670 So now let's discuss about the next step. 99 00:06:36,690 --> 00:06:44,530 So what we'll do, let's call let's try to find out the height and diameter of all subtree so left unsaid. 100 00:06:46,080 --> 00:06:47,970 So we'll call dysfunctioning diameter. 101 00:06:51,640 --> 00:06:53,500 We will pass the left necessary. 102 00:06:55,390 --> 00:07:01,570 So hydrometer function will give us the left answer, what is left unsaid, left and left, right and 103 00:07:01,570 --> 00:07:04,840 left DAYM and let's call the recursion. 104 00:07:07,170 --> 00:07:08,490 So this is right answer. 105 00:07:11,350 --> 00:07:14,620 Called the function radiometer and give it the right subtree. 106 00:07:15,760 --> 00:07:19,180 So what we are doing right now, so this is Salvatore. 107 00:07:22,230 --> 00:07:26,910 So I'm calling the function on the left subtree, it will return a pair of intelligent design, I'm 108 00:07:26,910 --> 00:07:30,400 calling it left unsaid, so it will return a pair left unsaid. 109 00:07:30,870 --> 00:07:35,860 So the first values are the second values Dimery, similarly, the first values site and the second 110 00:07:35,860 --> 00:07:36,450 one is damaged. 111 00:07:36,780 --> 00:07:39,440 So now we have left answer and we have a right answer. 112 00:07:39,690 --> 00:07:42,030 Let's find out these four values. 113 00:07:43,950 --> 00:07:45,240 So let's create variables. 114 00:07:46,790 --> 00:07:48,890 Integer left eight. 115 00:07:50,380 --> 00:07:51,010 This is. 116 00:07:52,630 --> 00:07:54,760 Left unsaid, darte first. 117 00:07:57,000 --> 00:07:58,840 So what is left diameter? 118 00:07:59,430 --> 00:08:00,000 This is. 119 00:08:01,140 --> 00:08:03,000 Left unsaid, dot second. 120 00:08:05,770 --> 00:08:08,710 Now, what is right, right, so this is. 121 00:08:09,700 --> 00:08:11,600 Right, answer that first. 122 00:08:13,890 --> 00:08:16,890 And what is right, diameter, so this is. 123 00:08:18,080 --> 00:08:19,760 Right answer, Nade second. 124 00:08:21,870 --> 00:08:27,240 So now we have all these values, we have these two values and we have these two values, and now it's 125 00:08:27,240 --> 00:08:32,460 time to find out the overall height and overall diameter and then we will return the pair. 126 00:08:32,520 --> 00:08:34,570 OK, so that is the function espere. 127 00:08:34,860 --> 00:08:39,419 So we construct a compared with the overall height and the overall diameter and then we will return 128 00:08:39,419 --> 00:08:39,929 dispair. 129 00:08:40,409 --> 00:08:42,900 So let's write the code for finding out the overall height. 130 00:08:44,510 --> 00:08:51,530 So in height, this is overall height and what is our own height, so this is one plus. 131 00:08:52,830 --> 00:08:56,760 Maximov left out a comma right out. 132 00:08:57,860 --> 00:08:59,540 And what is so little diameter? 133 00:09:01,020 --> 00:09:01,440 So. 134 00:09:03,080 --> 00:09:04,290 What is the overall diameter? 135 00:09:04,310 --> 00:09:12,350 So it has three options, so the maximum of what is the first option left out plus right eight second 136 00:09:12,350 --> 00:09:12,980 option is. 137 00:09:14,010 --> 00:09:18,720 Left VanMeter and third option is right to Dimitar. 138 00:09:20,310 --> 00:09:25,490 So we know what is all right and so we know what is right and what is our diameter. 139 00:09:25,650 --> 00:09:27,240 So now we need to return a here. 140 00:09:27,450 --> 00:09:29,150 There didn't have the function espere. 141 00:09:29,580 --> 00:09:30,900 So we will create a bear. 142 00:09:32,280 --> 00:09:38,370 So bear of indigenous or to be subpoenaed first. 143 00:09:39,660 --> 00:09:41,460 Is this all right? 144 00:09:47,410 --> 00:09:50,530 And be second is the overall diameter. 145 00:09:55,000 --> 00:09:58,720 So after constructing the pier, we need to return it also and return. 146 00:09:59,850 --> 00:10:00,150 B. 147 00:10:01,500 --> 00:10:03,300 So now I think this court will work. 148 00:10:03,630 --> 00:10:06,000 So let's run this court and then we'll submit. 149 00:10:10,710 --> 00:10:12,150 So now let's Amitava called. 150 00:10:18,300 --> 00:10:20,080 OK, so basically our goal is working. 151 00:10:20,370 --> 00:10:24,660 Now let's discuss the time, complexity, and then we will discuss how it will work. 152 00:10:25,020 --> 00:10:28,050 So first of all, let's discuss the time, complexity. 153 00:10:29,940 --> 00:10:34,550 So what we are doing here, we are calling it a collision on the left. 154 00:10:35,010 --> 00:10:36,840 We are calling it a collision, the right subtree. 155 00:10:39,980 --> 00:10:44,180 We are calling records for the left subtree, we are calling an occasion for the right subtree, so 156 00:10:44,180 --> 00:10:48,830 basically we are going to each and every node and let's see how much amount of work we are doing for 157 00:10:48,830 --> 00:10:52,700 each and so for each A. This is constant amount of work. 158 00:10:54,010 --> 00:10:59,240 This is constant work, this is constant work, this is constant work. 159 00:10:59,530 --> 00:11:04,420 So basically we are going to each and every node and for each and what we are doing constant work. 160 00:11:04,630 --> 00:11:06,880 So the total time complexity will be N.K.. 161 00:11:08,290 --> 00:11:13,630 So the total time complexities we are going through each and every note and for each node, we are doing 162 00:11:13,630 --> 00:11:14,830 a constant amount of work. 163 00:11:14,830 --> 00:11:17,350 So engaged, basically same as big often. 164 00:11:18,250 --> 00:11:24,950 So now you can see in the previous solution, our time complexity was and multiply by eight. 165 00:11:25,270 --> 00:11:28,110 So now our time complexity is big off. 166 00:11:28,120 --> 00:11:31,670 And so this solution is much better than the previous one. 167 00:11:31,960 --> 00:11:35,670 And now let's take an example and now let's see how our solution will work. 168 00:11:37,580 --> 00:11:43,820 So first of all, let's take a very simple example, so if tree has only one or so, if there is only 169 00:11:43,820 --> 00:11:47,340 one node, but we will do so, we will call the function on the left. 170 00:11:48,170 --> 00:11:49,790 So for the left, Sabry. 171 00:11:51,110 --> 00:11:58,760 The height is zero and zero zero zero, you will call the function of the lights of the idea zero and 172 00:11:58,760 --> 00:11:59,770 the diameter is zero. 173 00:11:59,990 --> 00:12:03,440 Now for this node you will calculate the overall height and overall diameter. 174 00:12:03,710 --> 00:12:04,610 So what is height? 175 00:12:04,790 --> 00:12:08,980 Height is left height, maximum of left, right, right, eight plus one. 176 00:12:09,440 --> 00:12:10,790 So height is one. 177 00:12:10,790 --> 00:12:11,850 And what is diameter. 178 00:12:12,050 --> 00:12:12,960 So three option. 179 00:12:13,280 --> 00:12:15,360 So the first option is left out. 180 00:12:15,740 --> 00:12:19,580 Right out, which is zero level diameter, which is zero, right down to zero. 181 00:12:19,730 --> 00:12:21,600 So maximum of zero zero zero. 182 00:12:21,620 --> 00:12:22,410 So it will be zero. 183 00:12:23,570 --> 00:12:29,300 So basically for one node, if my tree has only one node, height is one and diameter zero diameter 184 00:12:29,300 --> 00:12:29,930 should be zero. 185 00:12:30,050 --> 00:12:33,800 Because if there's only one node, then diameter should be zero. 186 00:12:33,800 --> 00:12:34,120 Right. 187 00:12:34,130 --> 00:12:39,470 Because for this diameter maximum distance between two nodes, maximum distance between any two nodes, 188 00:12:39,470 --> 00:12:41,880 but there is only one node, so there will be zero. 189 00:12:42,080 --> 00:12:43,880 So we know if there is only one node. 190 00:12:44,940 --> 00:12:50,410 The height is one and the diameter is zero, so let's see, let's take one more example. 191 00:12:51,240 --> 00:12:52,740 So if this is Maitri. 192 00:12:55,490 --> 00:13:01,310 If this is tree, then what should be the output so high, it should be too and diameter should be two, 193 00:13:02,060 --> 00:13:04,680 OK, diameter should be two and should be two. 194 00:13:04,700 --> 00:13:05,820 So let's see how it will work. 195 00:13:06,110 --> 00:13:09,430 So for one node, we know height is one and diameter zero. 196 00:13:09,680 --> 00:13:14,170 Similarly, if there's only one node, we know height is one and diameter is zero. 197 00:13:14,480 --> 00:13:15,440 Now for this node. 198 00:13:15,950 --> 00:13:17,090 What is the overall height. 199 00:13:17,310 --> 00:13:19,860 So the maximum of left, right, right, right. 200 00:13:19,880 --> 00:13:21,970 Which is one and one plus one is two. 201 00:13:22,490 --> 00:13:23,300 So it is two. 202 00:13:23,450 --> 00:13:24,610 And what is diameter. 203 00:13:24,740 --> 00:13:27,650 So diameter is the maximum of left height plus right height. 204 00:13:27,950 --> 00:13:28,760 So which is two. 205 00:13:29,870 --> 00:13:32,970 Left diameter, which is zero right diameter, which is zero. 206 00:13:33,170 --> 00:13:36,850 So we to take the maximum of these three, so the output will be two. 207 00:13:37,160 --> 00:13:38,300 So diameter is two. 208 00:13:39,310 --> 00:13:43,780 So, Heidi, still dealing with those two and which is the perfect answer, so you will return the time 209 00:13:44,080 --> 00:13:46,840 you will get to commit to and you are returning the diameter. 210 00:13:47,740 --> 00:13:50,170 So now let us take a complex example. 211 00:13:52,530 --> 00:13:56,220 So let's take a victory as input and then we will see what we decide in diameter. 212 00:13:56,640 --> 00:14:03,990 So if this is my three, one, two, three, four, five, six, seven. 213 00:14:05,230 --> 00:14:06,520 Eight and nine. 214 00:14:08,750 --> 00:14:16,220 So what will be the correct height and what is the correct diameter, so height is basically one, two, 215 00:14:16,220 --> 00:14:22,760 three and four, so I should be fought for this tree and diameter is so one, two, three, four and 216 00:14:22,760 --> 00:14:23,090 five. 217 00:14:23,390 --> 00:14:25,410 So diameter should be five and it should be four. 218 00:14:25,760 --> 00:14:31,850 So when will on give me the height and diameter to call on for medium height and diameter and for one 219 00:14:31,850 --> 00:14:33,770 node for when or what will happen. 220 00:14:33,770 --> 00:14:36,350 You will go on the left, you will get zero zero. 221 00:14:36,350 --> 00:14:37,180 You will call right. 222 00:14:37,220 --> 00:14:38,290 You will get zero zero. 223 00:14:38,300 --> 00:14:41,870 And for one node, if there is only one node we know the answer will be one zero. 224 00:14:42,880 --> 00:14:47,290 Similarly, if there is only one note, we have seen that the height is one diameter of zero. 225 00:14:48,430 --> 00:14:50,740 Height is one dimwitted zero. 226 00:14:52,650 --> 00:14:54,490 Height is one diameter of zero. 227 00:14:54,510 --> 00:15:00,350 Similarly for this, Naude height is one diameter zero Lalaji. 228 00:15:00,960 --> 00:15:03,480 So if one or two, what is the height? 229 00:15:03,480 --> 00:15:04,440 What is the overall height? 230 00:15:04,710 --> 00:15:09,870 So height is basically a maximum of left and right, which is one plus one. 231 00:15:10,140 --> 00:15:13,800 So height is two and what is diameter. 232 00:15:14,070 --> 00:15:20,070 So diameter is basically left height plus one plus one is two level diameter is zero. 233 00:15:20,070 --> 00:15:25,590 Right diameter is zero zero zero and the maximum so two. 234 00:15:26,130 --> 00:15:27,690 So it will return to Clamato. 235 00:15:27,720 --> 00:15:30,600 Height is two, diameter is two for this node. 236 00:15:31,740 --> 00:15:33,150 So this is the same situation. 237 00:15:33,360 --> 00:15:37,620 So it will also return exactly the same thing, Heidi, is to Demetris to. 238 00:15:39,010 --> 00:15:43,710 So now let's see for node three to four, Naughtie, what is the height? 239 00:15:45,110 --> 00:15:51,980 So basically, it is Maximov, left, right, right, right, plus one, so for three, it will be three. 240 00:15:53,170 --> 00:16:02,290 And what is the diameter, so diameter 40 is basically left out, plus right out, two plus one is three, 241 00:16:02,980 --> 00:16:04,120 left diameter is two. 242 00:16:05,770 --> 00:16:07,100 Right, diameter is zero. 243 00:16:08,200 --> 00:16:13,240 That makes some of these two is three so high, it is also three and diameter is also three. 244 00:16:14,260 --> 00:16:17,400 So now let's find out the answer for one, two for one. 245 00:16:17,410 --> 00:16:18,340 What is the height? 246 00:16:18,460 --> 00:16:22,160 So height is maximum of left height and right eight plus one. 247 00:16:22,180 --> 00:16:24,160 So it will be three plus one four. 248 00:16:24,610 --> 00:16:25,780 And what is your diameter? 249 00:16:26,020 --> 00:16:29,720 So diameter four one is basically the left height plus right eight. 250 00:16:29,740 --> 00:16:36,670 So two plus three comma left diameter which is two right diameter which is three. 251 00:16:37,480 --> 00:16:38,980 So the maximum will be five. 252 00:16:39,010 --> 00:16:40,320 OK, so this value is five. 253 00:16:40,600 --> 00:16:41,920 So we need to take the maximum. 254 00:16:41,920 --> 00:16:42,880 So maximum is five. 255 00:16:43,090 --> 00:16:44,620 So diameter is five. 256 00:16:45,940 --> 00:16:47,160 OK, so what happened? 257 00:16:49,130 --> 00:16:51,980 OK, so this is Natalie, so now you can see. 258 00:16:54,440 --> 00:17:00,470 So now you can see the height is four and five, and which is the right answer, height is for and diameter 259 00:17:00,470 --> 00:17:04,710 is five, so you will get a pair here and you are returning the second value. 260 00:17:04,910 --> 00:17:06,880 So second value was diameter. 261 00:17:08,119 --> 00:17:09,920 So that's how everything was working. 262 00:17:09,920 --> 00:17:12,980 And the time, complexity of this code is basically big often. 263 00:17:15,310 --> 00:17:21,819 So this approach of returning to things from what we are doing so annoyed is calling on another note 264 00:17:21,819 --> 00:17:27,829 and that note is returning to things at once, this calculating both the things at once in only one 265 00:17:27,829 --> 00:17:33,820 location call, and it is returning to values, or you can say it is returning multiple values. 266 00:17:33,950 --> 00:17:36,950 So this technique, this approach is used in many problems. 267 00:17:37,180 --> 00:17:40,900 So, for example, if there is a problem in which you find out four things. 268 00:17:42,110 --> 00:17:45,900 If you were to find out four things at once, then you can use this approach. 269 00:17:46,400 --> 00:17:50,390 So what we will do so this class is only for two things. 270 00:17:50,390 --> 00:17:56,210 In this case, if you want four things at once, so you will create a glass, your own glass, let's 271 00:17:56,210 --> 00:17:57,350 say glass information. 272 00:17:57,650 --> 00:18:03,920 You want four things at once and you will write these four things first thing second, third and fourth, 273 00:18:04,430 --> 00:18:09,600 and then identify what the functional information so you will return an object of glass information. 274 00:18:10,100 --> 00:18:14,110 So this approach, this technique is very useful going forward. 275 00:18:14,120 --> 00:18:16,940 You may encounter such problems in that problems. 276 00:18:16,940 --> 00:18:21,680 In order to get a good time complexity, you need to return multiple things at once. 277 00:18:21,680 --> 00:18:26,540 And this is the technique for returning multiple things, for calculating and for returning multiple 278 00:18:26,540 --> 00:18:27,240 things at once. 279 00:18:28,460 --> 00:18:30,250 So this question is very important. 280 00:18:30,620 --> 00:18:35,130 So many companies ask this question, OK, so this question is very important. 281 00:18:35,150 --> 00:18:41,630 Diameter of a binary mining company ask this question in their interviews so you should know how everything 282 00:18:41,630 --> 00:18:42,100 is working. 283 00:18:42,350 --> 00:18:43,700 So this is it from this video. 284 00:18:43,700 --> 00:18:44,960 I will see you in the next one.