aayushi-droid / Edabit-Solutions

Edabit Solutions using Cpp(C++)
MIT License
39 stars 154 forks source link

Rrepeated and Missing Numbers using c++ #298

Closed emnikhil closed 3 years ago

emnikhil commented 3 years ago

-->Method -- Use elements as Index and mark the visited places -->Approach:

  1. Traverse the array.

  2. While traversing, use the absolute value of every element as an index and make the value at this index as negative to mark it visited.

  3. If something is already marked negative then this is the repeating element.

  4. To find missing, traverse the array again and look for a positive value.

aayushi-droid commented 3 years ago

No issue no., Unable to check the issue assignment