filmov
tv
leetCode #41 First Missing Positive | JSer - algorithm and JavaScript
Показать описание
#41 First Missing Positive
We tried two different approaches, the first actually looks straightforward yet time complexity requirement is not satisfied.
A second approach would be a common technique when handling array, sorting/searching .etc, when index is related to the value, we could often try to move the number directly to the right position, and swap with the number there. this helps a lot.
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.
We tried two different approaches, the first actually looks straightforward yet time complexity requirement is not satisfied.
A second approach would be a common technique when handling array, sorting/searching .etc, when index is related to the value, we could often try to move the number directly to the right position, and swap with the number there. this helps a lot.
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.