Find Duplicates in O(N) time and O(1) space-DSA Amazon Interview qs

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Nice concept 👍
And thoroughly explained ✨

cse__rajkumarshaw
Автор

Great idea...!
Off handedly when I saw the problem I had thought of the swapping technique which basically placed a[i] at index "i" (ofc by exchanging) in one sweep across the array...

So now whichever a[i] isn't at "i" is a duplicate.
Well ofc I don't know if it can handle all cases because as I said, I thought very off handedly...

So yea.. Good one..!

HHarsh-coyz
Автор

Ei idea ta amar er age aseni....
"Sher aaya Sher"
Thanks for the explanation and the idea.🙂

soumenmahata
Автор

But this will not work on array having more than 2 duplicates of a element

priyanshukasaudhan