Junior — Senior
Identifying duplicate elements in an array
livecode
Task condition
The function should determine whether there is at least one element in the given array that occurs more than once.
Example: Input: [1, 2, 3, 4, 5] → false Input: [1, 2, 3, 1, 5] → true
class Main {
public static void main(String[] args) {
int[] arr;
boolean hasDup = containsDuplicate(arr);
}
public static boolean containsDuplicate(int[] numbers) {
return false;
}
}