Skip to content
Advertisement

Moving specific number (without sort) to the left of list

I want to just move the zero’s to left and don’t want to sort the list.

For example, if my list is like:

JavaScript

Here’s the output which I desire after moving all the Zero’s to left:

JavaScript

Here’s the code I tried:

JavaScript

This code gives me output as:

JavaScript

But my desired output is:

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement