How do we find duplicate element in an array
Answers
Answered by
2
Explanation:
Duplicate elements can be found using two loops. The outer loop will iterate through the array from 0 to length of the array. The outer loop will select an element. The inner loop will be used to compare the selected element with the rest of the elements of the array.
Answered by
1
Answer:
Traverse the array once. While traversing, keep track of count of all elements in the array using a temp array count of size n, when you see an element whose count is already set, print it as duplicate.
Similar questions