Given an array, move all zeroes to the end of the array while maintaining the relative order of the non-zero elements. 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...
SAP Software Developer interview questions & answers
A Software Developer was asked 5mo agoQ. If you have 1 million requests, how will you manage that?
A Software Developer was asked 9mo agoQ. Implement a stack using queues.
A Software Developer was asked 10mo agoQ. Write a function that reverses a string.
Popular interview questions of Software Developer
A Software Developer was asked 5mo agoQ1. If you have 1 million requests, how will you manage that?
A Software Developer was asked 9mo agoQ2. Implement a stack using queues.
A Software Developer was asked 9mo agoQ3. Write a function that reverses a string.
Top HR questions asked in SAP Software Developer
A Software Developer was asked 8mo agoQ1. Introduce yourself.
A Software Developer was asked 10mo agoQ2. What is your top priority when choosing a new job?
A Software Developer was asked 10mo agoQ3. Tell me about your current project and the technologies you are using.
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

