Write a Java program to move all 0's to the end of an array. Maintain the relative order of the other (non-zero) array elements. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Write a Java program to move all 0's to the end of an array. Maintain the relative order of the other (non-zero) array elements.

send logic

31st Jul 2019, 4:56 PM
Prakash Ranjan
Prakash Ranjan - avatar
2 Antworten
+ 1
You basically want a sorting algorithm like bubble sort, that is only sensitive for 0s
31st Jul 2019, 5:10 PM
Loeschzwerg
+ 1
Yes
31st Jul 2019, 5:32 PM
Prakash Ranjan
Prakash Ranjan - avatar