1 00:00:01,700 --> 00:00:02,340 Hi, everyone. 2 00:00:02,360 --> 00:00:05,450 So in this video, we are going to solve this question first, but. 3 00:00:06,440 --> 00:00:12,170 OK, so what is the question so the input will basically be in and is basically a positive integer and 4 00:00:12,170 --> 00:00:14,480 what we have to do, we have to print all the numbers. 5 00:00:15,170 --> 00:00:22,280 We have to print all the numbers from one to N, OK, but they sketch if the number is basically multiple 6 00:00:22,280 --> 00:00:23,900 of three, I have to print face. 7 00:00:24,170 --> 00:00:26,990 If the number is multiple of five, I have to print both. 8 00:00:27,080 --> 00:00:30,710 If the number is basically multiple of three and five, then I will print fishbowls. 9 00:00:30,790 --> 00:00:33,420 OK, let's take an example to understand the question. 10 00:00:33,440 --> 00:00:38,080 OK, so if the value of it is five now consider this question. 11 00:00:38,090 --> 00:00:43,160 So I have to print all the numbers from one to N, so my output should be one, then two, then three, 12 00:00:43,190 --> 00:00:44,280 then four and then five. 13 00:00:44,780 --> 00:00:46,010 So this should be my output. 14 00:00:46,250 --> 00:00:49,970 But the condition is if you encounter a multiple of three, you will write this. 15 00:00:50,070 --> 00:00:52,000 So this is a multiple of three. 16 00:00:52,010 --> 00:00:56,390 So I will write phisit, I will not write three, I will write Phizer. 17 00:00:57,200 --> 00:00:59,740 Similarly, this is basically a multiple of five. 18 00:00:59,750 --> 00:01:01,460 If you have multiple of five, you will write. 19 00:01:01,460 --> 00:01:03,410 But so I will write Boissiere. 20 00:01:04,269 --> 00:01:12,070 OK, so this is my output one, two, phase four, buzz, OK, one, two, phase four and Buzz. 21 00:01:12,100 --> 00:01:15,300 So this is the question and I hope you understood the question. 22 00:01:15,310 --> 00:01:16,570 Let us take one more example. 23 00:01:17,340 --> 00:01:19,930 So suppose the value of this 15, what you have to do. 24 00:01:20,230 --> 00:01:24,920 So my simple output will be one, two, three, basically from one to 15. 25 00:01:24,940 --> 00:01:27,280 OK, I have to print the numbers from one to 15. 26 00:01:27,310 --> 00:01:33,910 So it will be one, two, three, four, five, six, seven, eight, nine, 10, 11, 12, 13, 14 27 00:01:33,910 --> 00:01:34,460 and 15. 28 00:01:34,600 --> 00:01:36,310 So this is the normal output. 29 00:01:36,310 --> 00:01:39,460 But whenever you encounter a multiple of three, you will write this. 30 00:01:39,520 --> 00:01:43,230 OK, so first let's solve this one, multiple of three and five. 31 00:01:43,240 --> 00:01:46,320 So multiple of three and five. 32 00:01:46,330 --> 00:01:47,410 So this is 10. 33 00:01:47,660 --> 00:01:51,100 OK, so instead of 10, what I will write, I will write for about. 34 00:01:52,420 --> 00:01:53,830 So I will write fishbowls. 35 00:01:55,990 --> 00:01:59,830 And 15 is also a multiple of three and five, so I will write this here. 36 00:02:02,020 --> 00:02:07,290 OK, now let's see what are the multiples of three, so multiples of three is basically this one. 37 00:02:07,660 --> 00:02:09,009 So I will write here. 38 00:02:10,669 --> 00:02:13,220 Six is also a multiple of three, so I will write with. 39 00:02:14,960 --> 00:02:20,030 I will write her instead of printing and I will print face, OK, and some will. 40 00:02:20,350 --> 00:02:27,590 So instead of printing tool, I will write with simple analogy, multiple of five, I have to ride a 41 00:02:27,630 --> 00:02:29,650 bus to five. 42 00:02:29,660 --> 00:02:31,160 So I have to ride the bus here. 43 00:02:33,710 --> 00:02:36,260 Ten is already done and 15 is already done. 44 00:02:36,320 --> 00:02:46,760 OK, so this should be my output one two, phase four bus phase seven eight, phase phase bus 11, phase 45 00:02:46,760 --> 00:02:48,110 13, 14 and phase. 46 00:02:48,110 --> 00:02:50,390 But OK, so this is the question. 47 00:02:50,470 --> 00:02:52,660 OK, I hope you understood the question very well. 48 00:02:53,810 --> 00:02:55,680 So the question is very, very simple. 49 00:02:56,120 --> 00:02:57,770 So this is a very easy question. 50 00:02:57,770 --> 00:02:58,420 What do you have to do? 51 00:02:59,180 --> 00:03:01,780 You will simply iterate from one doing OK. 52 00:03:02,360 --> 00:03:07,370 It will simply iterate from one to N and for each number you will check if it is a multiple of three, 53 00:03:07,400 --> 00:03:10,340 it will benefit every multiple of five you will bring. 54 00:03:10,370 --> 00:03:15,430 But if it is multiple of both three and five, you will benefit, but otherwise you will simply print 55 00:03:15,440 --> 00:03:16,110 that number. 56 00:03:16,270 --> 00:03:18,500 OK, very, very simple question. 57 00:03:18,530 --> 00:03:20,090 Just implementation problem. 58 00:03:20,120 --> 00:03:22,250 OK, so now let's write the code. 59 00:03:22,490 --> 00:03:22,850 OK. 60 00:03:24,910 --> 00:03:26,240 So this is the question, OK? 61 00:03:26,360 --> 00:03:31,260 Whispers So this is basically the input and this the input, I have to print the numbers from one to 62 00:03:31,270 --> 00:03:35,860 N, OK, and we have to return that trusting, OK, we don't have to print anything. 63 00:03:35,860 --> 00:03:37,600 We have to return the string. 64 00:03:37,980 --> 00:03:38,290 OK. 65 00:03:39,710 --> 00:03:41,630 So now let us construct our own set. 66 00:03:43,900 --> 00:03:50,700 Are trusting, let's name it down, said, OK, it will be an OK, now let us hydrate. 67 00:03:50,710 --> 00:03:52,540 So I have to go from one to one. 68 00:03:53,480 --> 00:03:59,080 I have to print all the numbers from when doing OK, so I was when I left an article when I placeless. 69 00:04:01,340 --> 00:04:06,770 So what I have to do, I have to write simple if condition, so if the given number is basically. 70 00:04:07,930 --> 00:04:16,720 Divisible by three, that means multiple of three and the given number is basically multiple of five. 71 00:04:16,750 --> 00:04:18,370 So that means that there will be zero. 72 00:04:18,399 --> 00:04:20,589 OK, so this is model operator. 73 00:04:20,620 --> 00:04:23,200 OK, so this person symbolises more low pressure. 74 00:04:24,020 --> 00:04:26,320 It will the remainder it will give us the remainder. 75 00:04:26,350 --> 00:04:26,570 OK. 76 00:04:26,590 --> 00:04:30,500 So if the remainder is zero, that means the given number is due as well by three and five. 77 00:04:30,550 --> 00:04:33,910 OK, so that means the given numbers, multiple of three and five. 78 00:04:34,060 --> 00:04:38,920 So what I can do, I will write an Sadaat push back. 79 00:04:41,030 --> 00:04:46,620 So where did the string string is basically if it was OK, so let's copy this one string is Facebook's. 80 00:04:51,120 --> 00:04:57,750 OK, now, again, in the elusive condition, what I have to do so if the given number, which is I 81 00:04:58,080 --> 00:05:04,390 so have the given number on dividing by three gives it a zero, that means the given number is basically 82 00:05:04,390 --> 00:05:05,250 a multiple of three. 83 00:05:05,970 --> 00:05:08,160 So I will write Sadaat Push Back. 84 00:05:11,900 --> 00:05:13,220 So I have to copy this. 85 00:05:13,760 --> 00:05:14,120 OK. 86 00:05:16,090 --> 00:05:17,080 Let's go before his. 87 00:05:21,220 --> 00:05:24,220 And in the end, if conditions or if they're given No. 88 00:05:25,250 --> 00:05:31,630 On dividing my life gives me tremendous zettl, that means that given them is basically multiple of 89 00:05:31,630 --> 00:05:32,030 five. 90 00:05:32,070 --> 00:05:35,630 OK, so I will write Sadaat back. 91 00:05:37,990 --> 00:05:40,660 So what is the string string is basically. 92 00:05:41,080 --> 00:05:43,480 OK, so I will cooperate and I will be straight here. 93 00:05:46,450 --> 00:05:49,970 Now, in the last part, I will simply push that number, OK? 94 00:05:49,990 --> 00:05:53,300 So I have to simply push when I have to simply push too. 95 00:05:53,590 --> 00:05:53,980 OK. 96 00:05:55,320 --> 00:05:56,970 But this is basically. 97 00:05:57,450 --> 00:06:00,450 OK, so it is basically integer have to convert it into string. 98 00:06:00,480 --> 00:06:01,830 OK, so this is vector. 99 00:06:06,530 --> 00:06:07,550 So what I have to do. 100 00:06:08,770 --> 00:06:10,030 I Sadaat, push back. 101 00:06:14,260 --> 00:06:19,330 So if you will, right answer or push back, this is wrong, OK, right, this is wrong because you 102 00:06:19,330 --> 00:06:27,170 can see clearly I is basically of the type integer, whereas in the answer vector I can only push string. 103 00:06:27,190 --> 00:06:30,100 OK, so what I have to do, I have to convert this integer. 104 00:06:30,100 --> 00:06:33,280 So I is basically integer so I have to convert this integer. 105 00:06:33,280 --> 00:06:33,910 Interesting. 106 00:06:35,390 --> 00:06:36,990 OK, you can see it yourself. 107 00:06:37,010 --> 00:06:40,990 So one is basically string here, it is not integer one, it is string one. 108 00:06:41,300 --> 00:06:46,360 So I have inbuilt function in C++ then the function is to underscore string. 109 00:06:46,970 --> 00:06:52,550 So what it will take, it will take integer, it will take as indigenous input and it will return a 110 00:06:52,550 --> 00:06:53,700 string as output. 111 00:06:53,720 --> 00:06:56,780 OK, so I will use this function boosting. 112 00:06:59,180 --> 00:07:06,460 But instead of push back, I what I will write, I will use the function to string and I will give indigenous 113 00:07:06,470 --> 00:07:06,800 input. 114 00:07:06,800 --> 00:07:08,630 So it is basically a OK. 115 00:07:10,620 --> 00:07:13,050 Now, equidistant, OK, this is the complete code. 116 00:07:13,320 --> 00:07:18,000 Now what I will do, I will return my answer, OK, because I have to return vector of integers. 117 00:07:18,000 --> 00:07:19,470 So let us return our answer. 118 00:07:22,650 --> 00:07:26,820 OK, so I did a spelling mistake here. 119 00:07:38,390 --> 00:07:40,910 OK, our court is looking fine, and I'll somebody called. 120 00:07:45,300 --> 00:07:47,070 OK, so our court got accepted. 121 00:07:47,100 --> 00:07:50,310 Now let's discuss the time and the space complexity of our solution. 122 00:07:50,390 --> 00:07:53,250 OK, so basically what is the time complexity? 123 00:07:53,250 --> 00:07:56,390 So we are just ideating from one to end. 124 00:07:56,580 --> 00:07:58,640 Sort of complexity is basically big often. 125 00:07:58,650 --> 00:08:00,590 And similarly, the space complexities. 126 00:08:00,600 --> 00:08:01,340 Big of one. 127 00:08:01,420 --> 00:08:01,740 OK. 128 00:08:03,840 --> 00:08:06,000 Now, do not consider it as a OK. 129 00:08:06,000 --> 00:08:10,830 OK, this will not be considered as extra space because in the question it is given that I have to that 130 00:08:10,830 --> 00:08:11,430 trusting. 131 00:08:11,460 --> 00:08:13,470 OK, so this is basically required. 132 00:08:13,470 --> 00:08:15,110 I have to create this, Eddie. 133 00:08:15,500 --> 00:08:18,780 OK, so this ad is basically we have to create this idea. 134 00:08:18,810 --> 00:08:21,900 So this idea will not be counted in the extra space. 135 00:08:21,930 --> 00:08:24,840 OK, so that's why the space is basically order one. 136 00:08:25,180 --> 00:08:28,770 OK, this area will not be considered in space calculation. 137 00:08:29,670 --> 00:08:34,600 OK, so space complexity will be hard enough when we are not using any external space. 138 00:08:34,679 --> 00:08:37,909 OK, so if you have any doubt in this question, you can ask me. 139 00:08:37,950 --> 00:08:38,610 OK, thank you.