• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
November 02, 2023 |1.2K Views
PROBLEM OF THE DAY: 31/10/2023 | Move all zeroes to end of array
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Jay Dalsaniya. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Arrays but will also help you build up problem-solving skills.

In this video, we are given, an array arr[] of n positive integers. Push all the zeros of the given array to the right end of the array while maintaining the order of non-zero elements. Do the mentioned change in the array in-place.

Example :

Input:
N = 5
Arr[] = {3, 5, 0, 0, 4}
Output: 3 5 4 0 0

Explanation: The non-zero elements preserve their order while the 0 elements are moved to the right.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/move-all-zeroes-to-end-of-array0751/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-java-compiler/c9bbd734-8477-48b9-8518-61795e6f4786