1 00:00:01,960 --> 00:00:02,740 Hi, everyone. 2 00:00:02,770 --> 00:00:06,050 So in this video, we are going to solve this question, remove character. 3 00:00:06,760 --> 00:00:08,680 So let's take one string as input. 4 00:00:08,710 --> 00:00:15,860 So if this is our string A, B, C, D, A, B, E, F, and then we have none. 5 00:00:16,210 --> 00:00:20,230 So what I want to do so I want to remove character from my string. 6 00:00:20,650 --> 00:00:21,760 So is President Taylor. 7 00:00:21,760 --> 00:00:25,350 So remove a remove a and what is my final string. 8 00:00:25,390 --> 00:00:27,660 B, C, D, bsf. 9 00:00:28,060 --> 00:00:33,790 So given this string I need to return this string, I have to change, I need to modify the given string. 10 00:00:35,030 --> 00:00:39,790 OK, so I need to modify the string and I need to replace all the characters. 11 00:00:39,790 --> 00:00:46,870 A simple so we can solve this question with the help of Folbre I look but since we are learning regression 12 00:00:46,880 --> 00:00:49,120 so we will solve this question with the help of recursion. 13 00:00:49,990 --> 00:00:51,720 So let's see how we can solve this question. 14 00:00:52,000 --> 00:00:56,530 So what I'm planning to do here is so if this is our creperie. 15 00:00:57,400 --> 00:00:59,500 So first of all, let's talk about the biscuits. 16 00:00:59,830 --> 00:01:01,240 So biscuits is very simple. 17 00:01:01,540 --> 00:01:03,360 If I were correct, that is empty. 18 00:01:03,520 --> 00:01:05,620 So if basically input of zero is null. 19 00:01:06,760 --> 00:01:11,490 So if in Berdovsky regional if character is and then we do not need to do anything, we will simply 20 00:01:11,500 --> 00:01:13,660 have done so basically it's very simple. 21 00:01:13,990 --> 00:01:16,570 So now let's discuss about how we can solve this question. 22 00:01:17,390 --> 00:01:19,680 So first of all, I will check for the first element. 23 00:01:20,920 --> 00:01:22,020 I will do the small work. 24 00:01:22,300 --> 00:01:23,850 So let's check for the first element. 25 00:01:24,190 --> 00:01:26,290 So there are two possible cases. 26 00:01:26,320 --> 00:01:31,990 So first cases basically in Port of Zero is equal to the character. 27 00:01:33,220 --> 00:01:35,740 And second case is basically in Port of Zero. 28 00:01:37,460 --> 00:01:39,110 Is not close to correct, Perry. 29 00:01:40,820 --> 00:01:46,340 So if this is a situation gets to link it to is very simple, if it is not present here, let's say 30 00:01:46,340 --> 00:01:51,680 it is B, then you will simply call that equation on the on this area. 31 00:01:52,070 --> 00:01:55,770 So we will simply call the equation and we will give input plus one. 32 00:01:56,000 --> 00:01:57,980 So this is input plus one. 33 00:01:58,160 --> 00:02:03,020 So I'll simply call that equation on this small error and the equation will remove all the occurrence 34 00:02:03,020 --> 00:02:06,450 of that equation, will remove all the occurrences of it. 35 00:02:06,800 --> 00:02:10,729 We do not have to do anything if the situation is Kastel. 36 00:02:11,150 --> 00:02:17,220 Now let's talk about case one, so in case one character is present at the first position. 37 00:02:17,870 --> 00:02:23,820 So if this is a situation abcde, so character is present at the first position. 38 00:02:24,050 --> 00:02:29,210 So what I need to do, what I will do, I will copy all the characters, I will shift all the characters 39 00:02:29,210 --> 00:02:32,750 towards left and we have none here. 40 00:02:33,110 --> 00:02:35,770 So I will shift all the characters towards left. 41 00:02:36,170 --> 00:02:39,960 So it will become B, C, the null. 42 00:02:40,250 --> 00:02:42,660 So we are shifting Nael also and then we have none. 43 00:02:43,280 --> 00:02:44,890 So this will be our new string. 44 00:02:44,900 --> 00:02:51,170 McDannell So if this is a you need to remove a and what is the meaning of removing you will shift all 45 00:02:51,170 --> 00:02:52,820 the characters towards left. 46 00:02:53,270 --> 00:02:55,330 So this will be our new string BCT. 47 00:02:55,700 --> 00:03:02,180 So basically our new string will become B, C, D, and then you do not have to write to in one time 48 00:03:02,420 --> 00:03:03,050 sufficient. 49 00:03:04,260 --> 00:03:09,050 So I was doing this BCT and now we will call that it goes equation on this string. 50 00:03:09,650 --> 00:03:11,000 So we will give input. 51 00:03:11,270 --> 00:03:13,850 This is input and this is not input plus one. 52 00:03:14,120 --> 00:03:20,510 OK, so c originally we had A, B, C and this was input. 53 00:03:22,220 --> 00:03:31,100 So now I am moving all the characters towards left, so my setting will become B, C, the null and 54 00:03:31,340 --> 00:03:32,060 true timetable. 55 00:03:32,660 --> 00:03:35,660 So input is remaining, same input will remain the same. 56 00:03:35,890 --> 00:03:38,090 So we need to call that equation on input only. 57 00:03:38,570 --> 00:03:41,430 We need to call the equation on input and not input plus one. 58 00:03:42,290 --> 00:03:43,430 So let's write the code. 59 00:03:45,410 --> 00:03:48,030 So the name of the function will be void. 60 00:03:48,050 --> 00:03:50,840 We will not return anything, we will do the changes in the string. 61 00:03:50,900 --> 00:03:54,890 Only the name of the function is to remove a ring, to remove the character. 62 00:03:55,520 --> 00:03:57,770 I will take character areas and put. 63 00:03:58,820 --> 00:04:06,570 So the name of the character Ed is in, but the basic it is very simple if my character is empty, so 64 00:04:06,800 --> 00:04:10,100 basically in Port of Zero is null. 65 00:04:11,970 --> 00:04:17,459 In that case, you do not need to do anything you will simply have done, otherwise, you need to check 66 00:04:17,459 --> 00:04:18,500 for the first element. 67 00:04:18,839 --> 00:04:23,820 So if it is present, if he is not present at first and next. 68 00:04:26,180 --> 00:04:33,920 If this is a situation, what we need to do, see if this is our string B, C, D, E, so I am checking 69 00:04:33,920 --> 00:04:34,870 for the first position. 70 00:04:35,120 --> 00:04:40,810 So if it is not there, I will call that on this area and decide in port plus one. 71 00:04:41,510 --> 00:04:42,710 So let's call that equation. 72 00:04:43,620 --> 00:04:50,860 So, Danny, the function is remove me and I will give input plus one. 73 00:04:51,340 --> 00:04:52,560 So what will do? 74 00:04:53,430 --> 00:04:55,980 What I will do so it will remove all the ways. 75 00:04:56,160 --> 00:04:58,790 It will remove all the from this area. 76 00:04:58,980 --> 00:05:02,330 And my final testing will be basically simple. 77 00:05:02,520 --> 00:05:08,110 So the question will do the work correctly now in the ls part if it's present at the first index. 78 00:05:08,730 --> 00:05:16,860 So if it is present, if this is a situation A, B, C and D and we have done so, if it is present 79 00:05:17,220 --> 00:05:21,530 at the first index, then I need to shift all the characters towards left. 80 00:05:21,930 --> 00:05:27,750 So after shifting all the characters towards left, it will be B, C, D, we are shifting B and we 81 00:05:27,750 --> 00:05:29,500 are also shifting then null. 82 00:05:29,730 --> 00:05:34,030 And this is all original, so this remains him. 83 00:05:34,920 --> 00:05:36,320 So this will be my new string. 84 00:05:36,330 --> 00:05:40,230 So this is input and this is also input. 85 00:05:43,150 --> 00:05:44,650 So in the elzbieta, a little. 86 00:05:47,340 --> 00:05:50,530 And that's what we need to move all the characters towards left. 87 00:05:51,000 --> 00:05:52,840 So let's use a follow up. 88 00:05:53,850 --> 00:05:57,450 I will start from index zero and put a. 89 00:05:59,510 --> 00:06:00,780 Is not external. 90 00:06:02,750 --> 00:06:12,620 I placeless what we need to do, we need to write in Batarfi as equals to in Batoff I plus one. 91 00:06:14,590 --> 00:06:17,750 And after doing this, so what will happen, what will the effect of this line? 92 00:06:18,580 --> 00:06:23,820 So this is A, B, C and D, and then we have none. 93 00:06:24,850 --> 00:06:26,530 So I will start from zero. 94 00:06:26,530 --> 00:06:31,120 I am starting from index zero and I is it close to a plus one. 95 00:06:31,240 --> 00:06:33,100 So I equals to eight plus one. 96 00:06:34,360 --> 00:06:36,190 I is equals to a plus one. 97 00:06:37,330 --> 00:06:39,100 I is equals to eight plus one. 98 00:06:40,240 --> 00:06:44,320 I is equals two eight plus one I is equals two plus one. 99 00:06:44,950 --> 00:06:50,260 And then when we will reach the null, when we reach, then we will come out of this loop and that will 100 00:06:50,260 --> 00:06:50,800 remain the same. 101 00:06:51,100 --> 00:06:53,940 So this will be my new string new character three. 102 00:06:54,490 --> 00:07:00,760 And then what we need to do now we need to collocation on this because it is still present, OK, we 103 00:07:00,760 --> 00:07:01,810 need to call that equation. 104 00:07:02,050 --> 00:07:03,700 So input that it will remain same. 105 00:07:04,150 --> 00:07:06,530 This was the input error and this is still input. 106 00:07:06,530 --> 00:07:08,950 That is so we do not but input plus one. 107 00:07:09,520 --> 00:07:11,230 We will simply write input, OK. 108 00:07:13,770 --> 00:07:21,360 So let's call the function, let's call dedication, remove it and I will give input. 109 00:07:23,410 --> 00:07:27,440 So let's test our function, so we are printing our correct. 110 00:07:27,850 --> 00:07:30,460 Now let's call the function, remove a. 111 00:07:33,340 --> 00:07:34,250 I will give the input. 112 00:07:35,080 --> 00:07:40,870 And now let's do two things, let's spend the land, because Lenthall also degrees and let's bring in 113 00:07:40,870 --> 00:07:41,740 prudery also. 114 00:07:43,980 --> 00:07:48,690 So we are sprinting before removing the car today and we are sprinting after removing the character. 115 00:07:49,800 --> 00:07:51,570 So let's see, let's test our function. 116 00:07:57,520 --> 00:08:01,420 So let's say the input is A, B, C, D. 117 00:08:02,930 --> 00:08:10,920 E f, g, h, e, and then again, B and C. So let's see whether our output is correct or not. 118 00:08:11,360 --> 00:08:17,290 So initially the length is 13 and I need to call and function again. 119 00:08:17,300 --> 00:08:18,590 I'm just actually printing. 120 00:08:19,490 --> 00:08:20,210 So let's. 121 00:08:21,330 --> 00:08:22,560 Called the function again. 122 00:08:24,360 --> 00:08:32,070 So we need to call the function and not the variable, so this is lente function and we need to parse 123 00:08:32,070 --> 00:08:32,580 the input. 124 00:08:39,260 --> 00:08:51,500 So the input is received, a, b, c, d, e, f, g, h, e, and let's say the F, the land is basically 125 00:08:51,500 --> 00:08:54,940 17 to 17 and this is the input. 126 00:08:55,790 --> 00:08:57,670 So then is present. 127 00:08:57,770 --> 00:09:01,110 So it's present here is presented. 128 00:09:01,400 --> 00:09:03,820 So we will remove four characters. 129 00:09:03,830 --> 00:09:08,470 So the length becomes thirteen and you can see is not present in this. 130 00:09:08,480 --> 00:09:11,790 So we are updating, we are updating our input area. 131 00:09:12,080 --> 00:09:15,740 So I wouldn't put arrays change because that is our past biodefense. 132 00:09:16,430 --> 00:09:17,720 Let's test one more time. 133 00:09:19,840 --> 00:09:21,220 Let's test it one more time. 134 00:09:25,930 --> 00:09:33,820 So let's say the input is A, B, C, D, E, F, G, and again, A, B. 135 00:09:36,080 --> 00:09:45,020 So initially, the total number of characters is 10 Launceston, so is present two times here, one 136 00:09:45,020 --> 00:09:46,220 time here and one time here. 137 00:09:46,250 --> 00:09:49,160 So Lenthall decreased by four and here. 138 00:09:49,160 --> 00:09:54,550 So he's not President BCT, bct, FGB, FGB. 139 00:09:54,830 --> 00:09:57,750 So basically our function is working properly. 140 00:09:59,720 --> 00:10:01,150 So this is it from this video. 141 00:10:01,430 --> 00:10:02,690 I will see you in the next one.