Finding the duplicate element and the missing element in the given list with o(n) time complexity.

POULAMI BAKSHI
Apr 21, 2021
Question to solve!!

This article describes the implementation of the program to find the duplicate number in a given list of numbers using the minimum time complexity.

Code!!

Step 1:

we take input some numbers that contain duplicate numbers.

Step 2:

we create a new list which is having the same length as the first list. But, contains till n numbers.

Step 3:

we find the sum of the given array and the actual array. Now, find the difference between the sum of the array.

Step 4:

we find the sum of the square of the given array and the actual array. Now, find the difference between the sum of the square of the array.

Step 5:

Finally, we found the repeated and the missing element.

Thank you!!..

--

--