Implement arrayFindDuplicate(nums) — given an array of numbers, return true if any value appears at least twice, and false if every element is distinct. This is the classic LeetCode "Contains Duplicate" problem: you are not asked which value repeats or how often, only whether a repeat exists at all.
// nums: number[] — the array to inspect.
// returns: boolean — true if some value appears two or more times,
// false if every element is unique.
function arrayFindDuplicate(nums): boolean;
// 1 appears at both the start and the end.
arrayFindDuplicate([1, 2, 3, 1]);
// → true
// Every element is distinct.
arrayFindDuplicate([1, 2, 3, 4]);
// → false
true the moment a single value shows up twice. You do not need to find or report the value itself.arrayFindDuplicate([]) and arrayFindDuplicate([7]) both return false — there is nothing to repeat.0 is a real value, not an empty slot; [0, 1, 0] has a duplicate.nums; don't sort or splice it to detect repeats.