Hi, everyone.
So in this video, we are going to solve this question first, but.
OK, so what is the question so the input will basically be in and is basically a positive integer and
what we have to do, we have to print all the numbers.
We have to print all the numbers from one to N, OK, but they sketch if the number is basically multiple
of three, I have to print face.
If the number is multiple of five, I have to print both.
If the number is basically multiple of three and five, then I will print fishbowls.
OK, let's take an example to understand the question.
OK, so if the value of it is five now consider this question.
So I have to print all the numbers from one to N, so my output should be one, then two, then three,
then four and then five.
So this should be my output.
But the condition is if you encounter a multiple of three, you will write this.
So this is a multiple of three.
So I will write phisit, I will not write three, I will write Phizer.
Similarly, this is basically a multiple of five.
If you have multiple of five, you will write.
But so I will write Boissiere.
OK, so this is my output one, two, phase four, buzz, OK, one, two, phase four and Buzz.
So this is the question and I hope you understood the question.
Let us take one more example.
So suppose the value of this 15, what you have to do.
So my simple output will be one, two, three, basically from one to 15.
OK, I have to print the numbers from one to 15.
So it will be one, two, three, four, five, six, seven, eight, nine, 10, 11, 12, 13, 14
and 15.
So this is the normal output.
But whenever you encounter a multiple of three, you will write this.
OK, so first let's solve this one, multiple of three and five.
So multiple of three and five.
So this is 10.
OK, so instead of 10, what I will write, I will write for about.
So I will write fishbowls.
And 15 is also a multiple of three and five, so I will write this here.
OK, now let's see what are the multiples of three, so multiples of three is basically this one.
So I will write here.
Six is also a multiple of three, so I will write with.
I will write her instead of printing and I will print face, OK, and some will.
So instead of printing tool, I will write with simple analogy, multiple of five, I have to ride a
bus to five.
So I have to ride the bus here.
Ten is already done and 15 is already done.
OK, so this should be my output one two, phase four bus phase seven eight, phase phase bus 11, phase
13, 14 and phase.
But OK, so this is the question.
OK, I hope you understood the question very well.
So the question is very, very simple.
So this is a very easy question.
What do you have to do?
You will simply iterate from one doing OK.
It will simply iterate from one to N and for each number you will check if it is a multiple of three,
it will benefit every multiple of five you will bring.
But if it is multiple of both three and five, you will benefit, but otherwise you will simply print
that number.
OK, very, very simple question.
Just implementation problem.
OK, so now let's write the code.
OK.
So this is the question, OK?
Whispers So this is basically the input and this the input, I have to print the numbers from one to
N, OK, and we have to return that trusting, OK, we don't have to print anything.
We have to return the string.
OK.
So now let us construct our own set.
Are trusting, let's name it down, said, OK, it will be an OK, now let us hydrate.
So I have to go from one to one.
I have to print all the numbers from when doing OK, so I was when I left an article when I placeless.
So what I have to do, I have to write simple if condition, so if the given number is basically.
Divisible by three, that means multiple of three and the given number is basically multiple of five.
So that means that there will be zero.
OK, so this is model operator.
OK, so this person symbolises more low pressure.
It will the remainder it will give us the remainder.
OK.
So if the remainder is zero, that means the given number is due as well by three and five.
OK, so that means the given numbers, multiple of three and five.
So what I can do, I will write an Sadaat push back.
So where did the string string is basically if it was OK, so let's copy this one string is Facebook's.
OK, now, again, in the elusive condition, what I have to do so if the given number, which is I
so have the given number on dividing by three gives it a zero, that means the given number is basically
a multiple of three.
So I will write Sadaat Push Back.
So I have to copy this.
OK.
Let's go before his.
And in the end, if conditions or if they're given No.
On dividing my life gives me tremendous zettl, that means that given them is basically multiple of
five.
OK, so I will write Sadaat back.
So what is the string string is basically.
OK, so I will cooperate and I will be straight here.
Now, in the last part, I will simply push that number, OK?
So I have to simply push when I have to simply push too.
OK.
But this is basically.
OK, so it is basically integer have to convert it into string.
OK, so this is vector.
So what I have to do.
I Sadaat, push back.
So if you will, right answer or push back, this is wrong, OK, right, this is wrong because you
can see clearly I is basically of the type integer, whereas in the answer vector I can only push string.
OK, so what I have to do, I have to convert this integer.
So I is basically integer so I have to convert this integer.
Interesting.
OK, you can see it yourself.
So one is basically string here, it is not integer one, it is string one.
So I have inbuilt function in C++ then the function is to underscore string.
So what it will take, it will take integer, it will take as indigenous input and it will return a
string as output.
OK, so I will use this function boosting.
But instead of push back, I what I will write, I will use the function to string and I will give indigenous
input.
So it is basically a OK.
Now, equidistant, OK, this is the complete code.
Now what I will do, I will return my answer, OK, because I have to return vector of integers.
So let us return our answer.
OK, so I did a spelling mistake here.
OK, our court is looking fine, and I'll somebody called.
OK, so our court got accepted.
Now let's discuss the time and the space complexity of our solution.
OK, so basically what is the time complexity?
So we are just ideating from one to end.
Sort of complexity is basically big often.
And similarly, the space complexities.
Big of one.
OK.
Now, do not consider it as a OK.
OK, this will not be considered as extra space because in the question it is given that I have to that
trusting.
OK, so this is basically required.
I have to create this, Eddie.
OK, so this ad is basically we have to create this idea.
So this idea will not be counted in the extra space.
OK, so that's why the space is basically order one.
OK, this area will not be considered in space calculation.
OK, so space complexity will be hard enough when we are not using any external space.
OK, so if you have any doubt in this question, you can ask me.
OK, thank you.