COuld you suggest me the best algorithm to remove all zeros from given array in O(n) time and without external memory. For example, 1 2 0 0 3 2 0 2 becomes 1 2 3 2 2
use two pointers - one for read and one for write.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With