1 00:00:01,850 --> 00:00:02,790 Hello, everyone. 2 00:00:02,810 --> 00:00:08,140 So in this video, we are going to cover one more question, and the name of the question is Chartist 3 00:00:08,150 --> 00:00:09,190 unique prefix. 4 00:00:09,680 --> 00:00:10,860 So what is the question? 5 00:00:10,970 --> 00:00:13,290 So we will be provided with a list of words. 6 00:00:14,000 --> 00:00:15,410 So these are list of words. 7 00:00:15,410 --> 00:00:20,810 I have zebra dog, dog and of and what we need to do, we need to find out a prefix. 8 00:00:21,230 --> 00:00:24,470 And that perfect should be unique as a short list. 9 00:00:24,590 --> 00:00:30,170 And from that prefix we should be able to represent each word in the list. 10 00:00:30,710 --> 00:00:36,260 So for example here, if I take four zebra, if I take only the first character. 11 00:00:37,760 --> 00:00:40,990 So from the I can uniquely identify as zebra. 12 00:00:41,390 --> 00:00:41,820 Yes. 13 00:00:41,840 --> 00:00:43,520 Four short for dog. 14 00:00:43,520 --> 00:00:49,190 If I take only the first character which is D so from the can I uniquely identify dog. 15 00:00:49,190 --> 00:00:49,640 No. 16 00:00:49,850 --> 00:00:50,240 Why. 17 00:00:50,240 --> 00:00:53,530 Because is the prefix for dog, duck and dove. 18 00:00:54,320 --> 00:00:56,370 So I need to take the second character also. 19 00:00:56,390 --> 00:00:59,350 So from do, can I uniquely identify dog. 20 00:00:59,360 --> 00:00:59,770 No. 21 00:00:59,930 --> 00:01:00,230 Why. 22 00:01:00,230 --> 00:01:05,770 Because Due is coming here as well as do is the prefix for the word love. 23 00:01:06,050 --> 00:01:11,900 So if you take the third character G so from Dog I can uniquely identify the given word. 24 00:01:11,930 --> 00:01:16,970 So in this case, the prefix, the shortest common prefix and the word, they both are same. 25 00:01:18,140 --> 00:01:22,830 Now let's talk about character three so I three which is dog. 26 00:01:23,420 --> 00:01:29,450 So for Duck, if I take the word B again, this is not unique prefix from the. 27 00:01:29,450 --> 00:01:34,430 I cannot uniquely identify that because this is the prefix for this as well as for this. 28 00:01:35,120 --> 00:01:39,300 If I take you so from the you can uniquely identify dog. 29 00:01:39,320 --> 00:01:39,770 Yes. 30 00:01:39,770 --> 00:01:44,420 The EU is coming here only here, so they use the prefix for this. 31 00:01:44,600 --> 00:01:46,760 Now let's talk about the fourth word, which is. 32 00:01:47,240 --> 00:01:50,500 So if I take only the these coming here, here and here. 33 00:01:50,510 --> 00:01:51,670 So it's not unique. 34 00:01:51,920 --> 00:01:57,430 We cannot uniquely identify a word, though, from the similarly, the EU deal is also the perfect for 35 00:01:57,440 --> 00:02:01,280 dog, so I cannot uniquely identify those from do so. 36 00:02:01,280 --> 00:02:08,090 I need to take the third character also, which is V, so from the Ovie I can uniquely identify because 37 00:02:08,090 --> 00:02:13,060 the DV is only prefix is the prefix that is appearing here. 38 00:02:14,240 --> 00:02:15,380 So that's the question. 39 00:02:16,370 --> 00:02:24,730 So given a list of words, we need to find out the prefix and the prefix has to be unique as well as 40 00:02:24,740 --> 00:02:27,440 chartist to represent each word in the list. 41 00:02:27,680 --> 00:02:32,290 So now the question is how we can do this in the most optimal way. 42 00:02:32,690 --> 00:02:37,050 So the answer is basically by the help of provided a structure. 43 00:02:37,790 --> 00:02:39,920 So how private sector will help us here? 44 00:02:40,100 --> 00:02:42,190 So let's do one thing. 45 00:02:42,200 --> 00:02:45,160 Let's try to insert all the characters in a try. 46 00:02:45,770 --> 00:02:47,390 So what we will do is try. 47 00:02:47,390 --> 00:02:49,040 First of all, we have a root node. 48 00:02:52,030 --> 00:02:52,450 No. 49 00:02:53,570 --> 00:02:55,100 Let's say I'm inserting. 50 00:02:56,430 --> 00:03:01,410 This word Xebra, so I will modify my trial, that's structure, how I'm going to modify it. 51 00:03:01,410 --> 00:03:04,070 So initially I used to have only two things right. 52 00:03:04,080 --> 00:03:09,390 If you remember, the first one is basically a variable, which is of type is terminal. 53 00:03:10,170 --> 00:03:18,760 And second was basically a tile area of the success rate area, a trial area of size 26. 54 00:03:18,780 --> 00:03:20,970 What I will do, I will take one more variable. 55 00:03:21,420 --> 00:03:25,290 I will modify my route node, I will modify my node structure. 56 00:03:25,440 --> 00:03:27,660 I will take one more variable int count. 57 00:03:30,780 --> 00:03:37,990 Now, why I am taking this very blunt count and how it will help us here, let's try to analyze so far, 58 00:03:38,160 --> 00:03:40,850 but what I will do, I am inserting the first. 59 00:03:40,950 --> 00:03:42,210 So this is not present. 60 00:03:42,240 --> 00:03:47,890 I will insurgency and I will also need to update the value of this terminal. 61 00:03:47,910 --> 00:03:48,750 That will be false. 62 00:03:48,990 --> 00:03:50,580 Now, what will be the value of count? 63 00:03:51,540 --> 00:03:57,460 The value of count will be how many times this node, how many times we are going to this node. 64 00:03:58,440 --> 00:03:58,860 So. 65 00:03:59,920 --> 00:04:02,150 I'm coming to this node for the first time, right? 66 00:04:02,350 --> 00:04:06,760 I am coming to this node for the first time, so the count, the value of count will be one. 67 00:04:08,750 --> 00:04:13,900 And obviously, terminal is basically false falls, and this initially, all the values will be null. 68 00:04:15,470 --> 00:04:23,090 Now the second character is E, so I will make a. e and since we are coming at this node for the first 69 00:04:23,090 --> 00:04:29,140 time, so the count is one now, similarly for B, I am coming for the first time. 70 00:04:29,600 --> 00:04:31,460 So the count is be solid. 71 00:04:31,490 --> 00:04:34,330 So they counted the count for this one now. 72 00:04:34,460 --> 00:04:38,750 Similarly for I am coming for the first time at this nodes, the count is one. 73 00:04:39,590 --> 00:04:43,460 And similarly for a I am coming to this node for the first time. 74 00:04:43,460 --> 00:04:44,510 So the count is one. 75 00:04:44,660 --> 00:04:46,780 And also this note is our terminal load. 76 00:04:46,940 --> 00:04:52,040 So it must be highlighted basically is terminal will be true for this node. 77 00:04:52,340 --> 00:04:52,850 Simple. 78 00:04:53,330 --> 00:04:57,830 Now let's talk about the second character, the second word, which is dog. 79 00:04:59,030 --> 00:05:02,960 So again, I am coming to be for the first time. 80 00:05:03,170 --> 00:05:09,740 So the count will be one, not the next word is, oh, sorry, the next character is oh. 81 00:05:09,860 --> 00:05:11,900 So I'm going to over the first time. 82 00:05:11,900 --> 00:05:13,260 So the count is one. 83 00:05:14,930 --> 00:05:20,390 Similarly, the count for the character G is one because I'm coming at this node for the first time 84 00:05:20,600 --> 00:05:23,960 and also this is the terminal character. 85 00:05:23,960 --> 00:05:25,360 So I will highlight this. 86 00:05:26,630 --> 00:05:30,040 Now let's talk about the third word, which is duck. 87 00:05:30,290 --> 00:05:31,910 So D Yes. 88 00:05:31,910 --> 00:05:33,200 D is present here. 89 00:05:34,040 --> 00:05:38,810 So what I'm going to do, I'm coming at this node for the second time, so I will update this value 90 00:05:38,810 --> 00:05:39,320 to two. 91 00:05:41,760 --> 00:05:48,360 Now, the character is you, so I'm coming to this note for the first time, so the count is one. 92 00:05:50,700 --> 00:05:57,510 Now, the next see, so I'm coming at this node for the first time, so the count is one and four K. 93 00:05:57,570 --> 00:06:02,260 Similarly, the count is one, also the character case, the terminal. 94 00:06:02,280 --> 00:06:04,230 So we are going to highlight this. 95 00:06:06,220 --> 00:06:11,260 Now, let's talk about the last word, which is Dove so far, Dove. 96 00:06:12,550 --> 00:06:19,180 I'm coming at this node for the third time, so I will increase its value to three counties, basically 97 00:06:19,180 --> 00:06:22,140 storing how many times you are coming to this node. 98 00:06:22,330 --> 00:06:24,870 So I'm coming to node for the third time. 99 00:06:24,880 --> 00:06:26,570 So that's why the count becomes three. 100 00:06:27,100 --> 00:06:33,040 Now, the next year or so, I'm going to do this for the second time, so I will increase the value 101 00:06:33,040 --> 00:06:35,400 to two now. 102 00:06:36,010 --> 00:06:40,170 So V, I'm going to be this node V for the first time. 103 00:06:40,180 --> 00:06:41,290 So the count is one. 104 00:06:42,600 --> 00:06:49,320 And so similarly, I'm coming to this node for the first time to the counties one also this node is 105 00:06:49,320 --> 00:06:53,660 a terminal load, so I'm going to highlight this node simple. 106 00:06:53,970 --> 00:06:55,590 Now your tribe is ready. 107 00:06:55,900 --> 00:07:03,330 And now let's see how this tribe will help us in finding the answer, finding the prefix which is shortest 108 00:07:03,330 --> 00:07:04,260 as well as unique. 109 00:07:05,130 --> 00:07:07,710 So what I'm going to do is let's start with the first word. 110 00:07:09,110 --> 00:07:13,550 Let's start with the first word, so the first word is basically. 111 00:07:17,750 --> 00:07:26,480 The first word is basically is zebra, so I will start searching the word zebra in the try. 112 00:07:26,790 --> 00:07:29,750 OK, so this was basically what I've done till now. 113 00:07:29,750 --> 00:07:36,440 I'm calling the ER function, I'm calling the er function for these all forwards and in the er function 114 00:07:36,440 --> 00:07:37,040 what I have done. 115 00:07:37,250 --> 00:07:39,620 I'm also setting the value of variable count. 116 00:07:40,350 --> 00:07:43,910 We also need to set the value of variable count. 117 00:07:44,090 --> 00:07:47,170 So you need to modify the ER function accordingly. 118 00:07:48,020 --> 00:07:48,440 No. 119 00:07:50,370 --> 00:07:55,890 For finding out the prefix we are going to call this search function, and similarly, you will also 120 00:07:55,890 --> 00:07:58,130 modify a search function, how you will modify Lizzi. 121 00:07:58,500 --> 00:08:06,570 So for Xebra, first of all, to come to this node Z and the count is one count is one, that means 122 00:08:06,570 --> 00:08:08,660 this node is coming only for the first time. 123 00:08:09,120 --> 00:08:12,290 So you will stop here and you will return your answer, which is Z. 124 00:08:12,840 --> 00:08:15,940 So your answer for this word is basically Z. 125 00:08:16,770 --> 00:08:22,800 So what you need to do in the search function, as soon as you find a word whose count is when you will 126 00:08:22,800 --> 00:08:23,190 stop. 127 00:08:23,190 --> 00:08:24,390 And that will be your answer. 128 00:08:24,660 --> 00:08:25,580 So I will stop here. 129 00:08:25,590 --> 00:08:29,060 My answer is, let's take one more example for Dog. 130 00:08:29,520 --> 00:08:35,500 So I will go to this node D, go to this node and the count is three. 131 00:08:35,669 --> 00:08:36,990 OK, so the count is three. 132 00:08:36,990 --> 00:08:44,480 We need to move ahead, go to the node or so go to the node or or the count is to the count is not one. 133 00:08:44,640 --> 00:08:46,070 So we need to move ahead. 134 00:08:46,380 --> 00:08:47,490 So I will move ahead. 135 00:08:48,540 --> 00:08:55,020 For G and G, the count, this one, as soon as you encounter count one, you will stop and that will 136 00:08:55,020 --> 00:08:56,120 be a unique prefix. 137 00:08:56,370 --> 00:08:59,670 So my unique prefix for dog is basically dog only. 138 00:09:00,390 --> 00:09:02,070 Let's talk about the Third World, which is. 139 00:09:03,000 --> 00:09:06,360 So again, I will come to this node. 140 00:09:07,110 --> 00:09:09,870 I will come to this node and the count is basically three. 141 00:09:10,170 --> 00:09:11,310 So the count is not one. 142 00:09:11,310 --> 00:09:12,410 I need to move ahead. 143 00:09:13,290 --> 00:09:14,730 So now I will go to you. 144 00:09:16,560 --> 00:09:22,830 So for you, the count is one, as soon as the count is one, that means I'm coming at this door for 145 00:09:22,830 --> 00:09:23,630 the first time. 146 00:09:23,790 --> 00:09:25,320 That means it is unique. 147 00:09:25,930 --> 00:09:28,170 I have come at this door only one time. 148 00:09:28,200 --> 00:09:30,210 That means this is unique and you will stop here. 149 00:09:30,840 --> 00:09:31,920 So you will stop. 150 00:09:31,920 --> 00:09:34,060 And we will be until you announce will be the end. 151 00:09:34,110 --> 00:09:36,480 You simple, right? 152 00:09:37,170 --> 00:09:40,290 So you need to modify your search function. 153 00:09:40,470 --> 00:09:43,950 And as soon as you encounter count one, you will stop. 154 00:09:45,420 --> 00:09:47,880 Now let's talk about for this. 155 00:09:49,050 --> 00:09:54,540 So you will start from D to the county's three counties, not one. 156 00:09:54,540 --> 00:09:55,560 So you will move ahead. 157 00:09:55,860 --> 00:10:01,610 You will go to the second character, which is all the counties to you will move ahead. 158 00:10:01,770 --> 00:10:06,060 The third character is V, so you will go to V and the count is one. 159 00:10:07,250 --> 00:10:12,920 Count is one, and you will stop here, so the answer for this is the of which is the right answer. 160 00:10:14,460 --> 00:10:17,800 So that's how I try to help us, right? 161 00:10:18,150 --> 00:10:21,910 So these are the answer and our answer are basically correct. 162 00:10:22,170 --> 00:10:24,830 So what you need to do, you need to modify. 163 00:10:24,840 --> 00:10:29,430 First of all, you need to modify, you know, class and the lower class. 164 00:10:29,430 --> 00:10:32,070 You will have one more day to remember, which is count. 165 00:10:32,400 --> 00:10:38,250 Then you will need to modify the error function in which you need to modify the value of count, and 166 00:10:38,250 --> 00:10:40,650 then you need to modify your search function. 167 00:10:40,800 --> 00:10:45,780 As soon as you encounter an order with value, one with the count one, you will stop. 168 00:10:45,780 --> 00:10:47,330 And that will be your answer. 169 00:10:48,630 --> 00:10:49,450 Simple, right? 170 00:10:49,710 --> 00:10:53,220 So that's how the trial structure will help us in this problem. 171 00:10:53,760 --> 00:10:57,030 Now, the problem arises when the interviewer sees. 172 00:10:57,450 --> 00:11:04,710 So if the interviewer says you cannot take one more variable, taking account variable is not allowed. 173 00:11:04,800 --> 00:11:10,050 You can have at most two data members, which is is terminal and you already. 174 00:11:10,470 --> 00:11:13,670 So interviewer doesn't like this approach, although this approach is correct. 175 00:11:13,680 --> 00:11:17,160 But he insists you to find out another approach. 176 00:11:17,460 --> 00:11:22,470 He doesn't want you to use another variable and remember why. 177 00:11:22,620 --> 00:11:26,190 Because this is of integer type and this is basically a four bytes. 178 00:11:26,670 --> 00:11:33,690 So you're each node the size of each in order will increase by four bytes and introverted and one that 179 00:11:34,630 --> 00:11:36,600 simply says, no, this is not allowed. 180 00:11:36,840 --> 00:11:38,230 You cannot take more memory. 181 00:11:38,520 --> 00:11:42,930 So now how can you use to try to structure in this case? 182 00:11:45,500 --> 00:11:52,210 So let me it is everything and let me tell you how we can use try to judge in that case. 183 00:11:53,540 --> 00:11:59,120 So introducing only two the members are allowed, which is is terminal. 184 00:12:00,230 --> 00:12:02,150 And the second is basically you are adding. 185 00:12:03,310 --> 00:12:05,470 These two are the only members which are allowed. 186 00:12:05,980 --> 00:12:13,270 So, again, we need to modify our approach somehow so that we can uniquely identify the prefix and 187 00:12:13,270 --> 00:12:14,560 how we are going to do that. 188 00:12:15,160 --> 00:12:19,040 So what will you let us construct private sector again? 189 00:12:19,810 --> 00:12:21,460 So this is our route node. 190 00:12:23,920 --> 00:12:29,380 So initially, what is happening, the count variable, whatever the count variable is doing. 191 00:12:29,380 --> 00:12:31,060 So it is containing only two things. 192 00:12:31,060 --> 00:12:36,620 If you remember, the value of count can be one or it can be two three for anything else. 193 00:12:37,060 --> 00:12:41,950 So if the value of count is one, I'm going to stop and I am going to return. 194 00:12:41,950 --> 00:12:44,980 My answer and count of value is anything else. 195 00:12:44,980 --> 00:12:45,880 Then it doesn't matter. 196 00:12:45,880 --> 00:12:48,220 I need to continue searching. 197 00:12:48,830 --> 00:12:49,240 Right. 198 00:12:49,420 --> 00:12:52,660 So basically it seems like true or false typewrite. 199 00:12:53,050 --> 00:12:54,780 If the value is one, then stop. 200 00:12:54,790 --> 00:12:56,740 If the value is anything else, then continue. 201 00:12:57,010 --> 00:13:03,940 So basically we can do the same thing we can we can use the variable is terminal for doing the work 202 00:13:03,940 --> 00:13:04,480 of count. 203 00:13:04,690 --> 00:13:05,620 How so? 204 00:13:05,620 --> 00:13:14,850 For one, what we can do, we can use true and for the value we can use false simple rate discount what 205 00:13:14,860 --> 00:13:19,840 it is doing if the value of count is when they need to stop at zero to continue. 206 00:13:20,110 --> 00:13:27,250 Similarly, we can use the terminal data member to satisfy the to do the work of current variable and 207 00:13:27,250 --> 00:13:28,280 how we can do that. 208 00:13:28,300 --> 00:13:28,840 Let's see. 209 00:13:29,440 --> 00:13:30,850 Let's see how we can do that. 210 00:13:34,160 --> 00:13:44,210 So what I'm going to do is so let me draw the tray for you, and this is our route node, so I'm inserting 211 00:13:44,210 --> 00:13:44,920 the characters. 212 00:13:45,890 --> 00:13:51,980 And since I'm coming at this node for the first time, I will set the value of its terminal to be true. 213 00:13:52,610 --> 00:13:56,840 So if you remember in the previous approach, I was setting the value of count to be one. 214 00:13:56,840 --> 00:13:59,410 If I'm coming for the first time here, what I doing? 215 00:13:59,600 --> 00:14:02,510 I am setting the value of its terminal to be true. 216 00:14:03,890 --> 00:14:11,000 For the first time and for the rest of the times, the count will keep incrementing two, then three, 217 00:14:11,000 --> 00:14:13,250 then fourth and fifth and sixth and seventh and eighth. 218 00:14:13,430 --> 00:14:18,260 And for this case, what I will do, I will instead of true, I will change its value to false. 219 00:14:20,070 --> 00:14:22,110 That is the approach that we are trying to do here. 220 00:14:22,430 --> 00:14:27,890 So for me, I'm coming at this moment for the first time, for the first time, if you remember. 221 00:14:27,890 --> 00:14:30,350 What is the approach for one I am using. 222 00:14:30,350 --> 00:14:30,710 True. 223 00:14:31,820 --> 00:14:36,710 So I will set the value of time to be true then. 224 00:14:36,710 --> 00:14:43,580 Similarly for B, I'm coming at this not for the first time, so that the value to true then similarly 225 00:14:43,580 --> 00:14:45,470 are I will set the value true. 226 00:14:45,770 --> 00:14:48,740 Similarly for a I will set the value to. 227 00:14:51,610 --> 00:14:59,770 Let's insert DOJ Asep Sordi going for the first time through or coming for the first time, the value 228 00:14:59,770 --> 00:15:05,190 of this terminal is through G coming for the first time, the value of its terminal is through. 229 00:15:05,740 --> 00:15:07,750 Latins are the third way, says Doug. 230 00:15:08,320 --> 00:15:12,010 He'll be coming for the second time. 231 00:15:13,360 --> 00:15:15,070 You are coming here for the second time. 232 00:15:15,070 --> 00:15:19,720 So for second time, what they will do, you will change the value to false. 233 00:15:20,290 --> 00:15:24,280 So I will change the value to false in case of variable. 234 00:15:24,280 --> 00:15:30,510 I used to increment these values, but in case of using this terminal, I will change the value to false. 235 00:15:31,450 --> 00:15:33,270 Now the next is due. 236 00:15:33,580 --> 00:15:37,120 So you I am going for the first time. 237 00:15:37,120 --> 00:15:37,780 So true. 238 00:15:39,900 --> 00:15:46,190 See, I am coming for the first time through next character is key, I am coming for the first time, 239 00:15:46,200 --> 00:15:47,940 so the value of this terminal is true. 240 00:15:48,270 --> 00:15:51,410 Now, let's move on to our last word, which is love. 241 00:15:52,080 --> 00:15:56,930 So again, here we are coming for the third time. 242 00:15:56,940 --> 00:15:59,260 So the value of so the values already fall. 243 00:15:59,280 --> 00:16:00,910 So, again, we can change it to fall. 244 00:16:01,710 --> 00:16:05,450 Now, the next year or so, we are coming here. 245 00:16:05,460 --> 00:16:06,270 The value is true. 246 00:16:06,270 --> 00:16:07,640 We will change it to false. 247 00:16:09,030 --> 00:16:13,800 Now the next is V, so V doesn't V is coming for the first time. 248 00:16:13,800 --> 00:16:15,660 So I will change the value to true. 249 00:16:18,360 --> 00:16:26,040 Now he's coming for the first time, so I will tell you to do so again, but need to do you what are 250 00:16:26,040 --> 00:16:26,500 you doing? 251 00:16:26,520 --> 00:16:30,330 You are basically modifying your air function, right? 252 00:16:30,390 --> 00:16:32,610 You need to modify the air, the function of tri. 253 00:16:34,840 --> 00:16:41,360 For setting the value of Istomin and now let's talk about searching to find out the answer. 254 00:16:41,980 --> 00:16:44,110 So for Xebra, what I will do. 255 00:16:46,180 --> 00:16:53,200 So go to this node and it is true, true, true means you have come here only one time. 256 00:16:53,740 --> 00:16:56,470 You have visited this node only once. 257 00:16:57,150 --> 00:16:58,710 That's why I have to here. 258 00:16:59,710 --> 00:17:01,090 That means you need to stop. 259 00:17:01,760 --> 00:17:04,270 It is exactly like if the value of count is one. 260 00:17:04,270 --> 00:17:06,670 You have visited this not only once. 261 00:17:06,849 --> 00:17:13,270 Similarly, if the value of e-mail is true, you have visited this not only once since we have visited 262 00:17:13,270 --> 00:17:14,650 this, not only ones. 263 00:17:15,099 --> 00:17:16,450 That will be your answer. 264 00:17:16,480 --> 00:17:18,119 OK, so you will stop here. 265 00:17:18,369 --> 00:17:21,490 Your answer will be easy for dog. 266 00:17:22,130 --> 00:17:23,599 Let's see what will be the answer. 267 00:17:23,980 --> 00:17:27,380 So you will come here and the value is false. 268 00:17:27,550 --> 00:17:28,560 So you will move ahead. 269 00:17:29,300 --> 00:17:31,650 You will come here and the value is again false. 270 00:17:31,660 --> 00:17:32,650 So you will move ahead. 271 00:17:32,950 --> 00:17:35,920 You will come here and the value is to the values. 272 00:17:35,920 --> 00:17:36,250 True. 273 00:17:36,700 --> 00:17:38,130 Yeah, we will stop here. 274 00:17:38,140 --> 00:17:39,720 So the answer is dodgy. 275 00:17:40,900 --> 00:17:42,510 Now let's talk about Doug. 276 00:17:44,450 --> 00:17:46,790 So you are coming here. 277 00:17:50,400 --> 00:17:51,910 And the value is basically false. 278 00:17:52,260 --> 00:17:53,700 That means you will move ahead. 279 00:17:54,900 --> 00:17:59,740 So you will move ahead and the value is to the values, to you will stop. 280 00:17:59,760 --> 00:18:01,040 So the answer is do you? 281 00:18:01,740 --> 00:18:04,680 Let's talk about our last word, which is love. 282 00:18:04,920 --> 00:18:06,050 So you will come here. 283 00:18:06,570 --> 00:18:07,670 The value is false. 284 00:18:07,920 --> 00:18:08,940 You need to move ahead. 285 00:18:09,330 --> 00:18:10,290 You will come here. 286 00:18:10,470 --> 00:18:11,520 The value is false. 287 00:18:11,520 --> 00:18:12,480 You need to move ahead. 288 00:18:12,840 --> 00:18:17,520 You will come here and the value is true and you will stop. 289 00:18:17,550 --> 00:18:19,080 So your answer is Dovi. 290 00:18:20,290 --> 00:18:20,840 Right. 291 00:18:21,190 --> 00:18:28,480 So in this way, you will be able to find out your answer using the use if you you need to modify the 292 00:18:28,480 --> 00:18:31,780 search function and you will able to find out your answer. 293 00:18:32,080 --> 00:18:37,000 So the work of the variable count can easily be done by the variable rate. 294 00:18:37,220 --> 00:18:40,120 So this is how trials can help us here. 295 00:18:42,250 --> 00:18:50,890 And you can also see so the last law is basically storing the true value, right, because obviously 296 00:18:50,890 --> 00:18:56,260 this since this is the last node, it has to be true and they are storing true values. 297 00:18:58,930 --> 00:19:05,530 Now, one more doubt, if the person can have is basically, uh, for example, if I have a word dog 298 00:19:05,530 --> 00:19:13,090 and if I have if I have a word doggy, then with the prefix for this, because the prefix cannot be 299 00:19:13,090 --> 00:19:15,340 dog because dog is coming here also. 300 00:19:16,510 --> 00:19:20,110 So in this case, this is basically invalid input. 301 00:19:20,340 --> 00:19:24,010 OK, so this is not a valid input, this is invalid input. 302 00:19:25,220 --> 00:19:27,730 So these type of cases will not be presenting it in. 303 00:19:28,550 --> 00:19:30,390 You do not need to worry about that. 304 00:19:31,160 --> 00:19:31,550 OK. 305 00:19:31,580 --> 00:19:34,970 So this type of input will not represent only the valid inputs will be there. 306 00:19:35,870 --> 00:19:38,000 And I have discussed two approaches. 307 00:19:38,000 --> 00:19:44,780 One, if you need to modify, if you are allowed to modify, you are allowed to take extra memory. 308 00:19:44,780 --> 00:19:49,790 And if you are not allowed to take extra memory, then modifying the using the established member for 309 00:19:49,790 --> 00:19:56,230 the four for doing all the work that count variable was doing that. 310 00:19:56,270 --> 00:19:59,120 So you can use pride as a teacher in this problem. 311 00:19:59,420 --> 00:20:04,230 And this problem was asked in Google, according to this website. 312 00:20:04,790 --> 00:20:05,740 So yeah. 313 00:20:06,440 --> 00:20:09,910 So what you can do, you can try coding the solution yourself. 314 00:20:09,920 --> 00:20:14,450 I have discussed two approaches and you can write the code for one, the approach. 315 00:20:14,450 --> 00:20:18,740 And if you are extra hard working, then you can write the code for both the approaches. 316 00:20:19,220 --> 00:20:24,680 And if you face any problem in writing the code or if you are not able to understand the solution, 317 00:20:25,190 --> 00:20:27,590 will free to bring me out and give in section. 318 00:20:28,130 --> 00:20:31,680 So that's all that I want to discuss in this with guys. 319 00:20:32,120 --> 00:20:33,880 So this is from this video. 320 00:20:33,890 --> 00:20:35,460 I will see you in the next one. 321 00:20:35,930 --> 00:20:36,500 Thank you.