This was way cooler than the way that first came to mind!
@CodeWithZiАй бұрын
Thanks for your supportive comment!
@KarthikB-gy3oqАй бұрын
Use cyclic sort
@davidcalloway9062Ай бұрын
Also while watching it occurs to me that you could reuse the original array to write the missing numbers to by keeping an index of the next available position as you go through checking for positive numbers. In Go for example this would avoid additional allocation and potentially resizing the slice.
@CodeWithZiАй бұрын
Awesome approach! it can indeed optimize the memory usage