Hi everyone, let's do this question.
Given an array of integers numb's containing n plus one integers, where each integer is in the range
one to n inclusive.
There is only one repeated number in Numb's return this repeated number.
You must solve the problem without modifying the array numb's and use only constant extra space.
So this is the question over here.
Now let's try to understand this question.
It's given that the array numb's which is given to us has n plus one integers.
Now let's take an example.
Let's say this is six.
So let's say the array which is given to us has six integers.
Now over here it's mentioned.
Each integer in this array is in the range one to n.
And both of these one and n are inclusive.
So that means the integers in the array will be 1 to 5, and both one and five will be included in the
array.
And over here it's mentioned there is only one repeated number in numb's.
And we have to return this repeated number.
So that is the question over here.
For example, let's say the array has one, two, three, three, four and five.
So you can see it has six numbers.
And the numbers one, two three, four, five are there ones.
But three is occurring two times.
And we have to return the number three.
So that is the question over here.
All right.
So we have to return the number which is being repeated.
And the caveat is that we have to solve the problem without modifying the array.
And we can only use extra space.
Extra constant space.
All right.
So it should be O of one space complexity.
And we cannot modify the array.
Now over here the array is sorted.
But this is not necessary.
It could be something like this one then five then three then two then four.
This is also possible.
Right.
And then there is one more uh number which is that 112345.
Yeah.
Three.
Again three is repeating.
Right.
So this also could be the array.
Now we cannot modify the array.
So we cannot sort it or do anything like that.
But we have to identify the repeated number and return it.
So that's the question over here.
Now let's go ahead and write a few test cases to understand this question.
Now we have already looked at one test case.
If this is the array which is given to us, we have to return the repeated number which is three.
Now if the array has only two numbers one comma one and then one itself is the repeated number and we
would have to return one.
Now if the array is 132554, again we have six numbers.
And we can see that five is being repeated and we would have to return five.
Now again it's not necessary that these two should be together.
It could be separate also like we can have one, five, three, two, five and four.
Also in this case also we should be able to identify the repeating number and return it.
All right.
So this is the question.
So we have understood the question.
And we have written out a few test cases.
In the next video let's discuss how we can solve this question.