abhishekdoifode1 / Hacktoberfest2021

This Repo is created by Abhishek for the beginners to promote open source programming (hacktoberfest), you just need to add any type of code in any programing lang you want, just commit your name at the end. Give a Star⭐
130 stars 665 forks source link

Duplicate find in O(N) complexity #972

Open shresth12-jain opened 2 years ago

shresth12-jain commented 2 years ago

You have been given an integer array/list(ARR) of size N which contains numbers from 0 to (N - 2). Each number is present at least once. That is, if N = 5, the array/list constitutes values ranging from 0 to 3, and among these, there is a single integer value that is present twice. You need to find and return that duplicate number present in the array.