View theory topics
Question: Given an array with n+2 elements, all elements of the array are in range 1 to n and also all elements occur only once except 2 numbers which occur twice. Find those 2 repeating numbers. Input: arr [ ] = {6, 2, 6, 5, 2, 3, 1} Output: 6 2 We discussed the method to find the 2 repeating element using 2 loops, but that method had a great time complexity and it was not at all an optimal solution. We can optimize it using a count array. This …
