Given an array, sort the zeroes from non zeros for example Input: 1 2 0 0 7 4 42 0 0 0 6 Output: 1 2 7 4 42 6 0 0 0 0 0
AnswerBot
1y
Sort an array by moving all zeroes to the end.
Iterate through the array and move all non-zero elements to the front.
Count the number of zeroes encountered and append them at the end of the array.
Use t...read more
Prakhar Dhama
3y
Initially, make a function and pass array and number of elements of array(n) to the function.
Inside the function, declare and define a variable as counter equal to 0.
Run the for loop for traversing...read more
Help your peers!
Add answer anonymously...
Top SAP Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in SAP Software Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app