Question: Is my code error-free and solve the problem? Write a method called hasDuplicate() that takes as input an array of numbers and returns true if
Write a method called hasDuplicate() that takes as input an array of numbers and returns true if there is a duplicate number in the array, and returns false if array consists of unique numbers. For example, given [100, 4, 2, 2] your method should return true(since 2 is repeated), but given [1, 5, 2], your method should return false (since no element is repeated) ublic boolean hasDuplicate int] numbersArray) write your code here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
