Back to course home
0% completed
Vote For New Content
4th test case [5,5,5,5,5] is not part of problem statement
d.psawyer
Jul 9, 2023
Problem reads:
We are given an unsorted array containing n+1 numbers taken from the range 1 to n. The array has only one duplicate but it can be repeated multiple times. Find that duplicate number without using any extra space. You are, however, allowed to modify the input array.
However, we are supplied 5,5,5,5,5 as a test case. Given that the array is supposed to contain n+1 numbers taken from the range 1 to n If the number 5 is anywhere in the range 1 to n, then the minimum array length must be 6
2
0
Comments
Comments
On this page