LeetCode 442. Find All Duplicates in an Array| JSer - JavaScript & Algorithm

preview_player
Показать описание
A nice trick to keep putting numbers at the right position

Hi I'm a JavaScript engineer who is not good at algorithms,
and currently practicing leetCode online. If you are interested, maybe we can learn together.
Рекомендации по теме
Комментарии
Автор

I solved the issue with a different approach. I just sorted the array as the first step and then checked each number if its next digit is same or not. Accordingly remove the elements from the array. By this way I did not use extra space and also the time complexity is O(n)

shubhamghosh
join shbcf.ru