Let's have an array of N elements. And I need to make all 0 elements to come to last in array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Let's have an array of N elements. And I need to make all 0 elements to come to last in array

Example input : [1,2,0,0,4] Example output : [1,2,4,0,0] Cn I get different logic to solve this?

12th Sep 2021, 11:37 AM
GURURAJ KL
GURURAJ KL - avatar
3 Answers
+ 5
GURURAJ KL , ▪︎what language are you talking about? ▪︎and please also show us your attempt! thanks!
12th Sep 2021, 12:36 PM
Lothar
Lothar - avatar
+ 5
GURURAJ KL , the solutions we can suggest you are depending on your knowledge level of the language so when we get the required information from you we can suggest you an adequate solution.
12th Sep 2021, 1:09 PM
Lothar
Lothar - avatar
+ 3
Cn u justify the loop which u use to iterate and the conditional statements inside that?
12th Sep 2021, 11:51 AM
GURURAJ KL
GURURAJ KL - avatar