Returning duplicate elements in an array
Suppose you're given an array of positive integers of length n. Within the array, there will be one set of duplicate numbers. Write a function to read in the array and return the duplicate number.
input: a = [1,4,3,4,2] output: 4 input: a = [4,3,1,1] output: 1
Subscribe to premium account to see the solution.Get premium now