[1,2,3,4,4,5] would return 4.
Array is not sorted. Duplicate is guaranteed to be there, and to be the only dupe.
Solve in O(n) with O(1) space.
Is the array sorted? The word "sequential" and "values starting from 1" seem to imply that it is sorted.
not sorted. comment added.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.