Update appNew update is available. Click here to update.
About
Computer Science and Engineering with specialization in Internet of Things ' 26
Yeshwantrao Chavan College of Engineering (YCCE), Nagpur 2026
My Stats
EXP gained
yellow-spark
4732
Level
5 (Champion)
Community stats
Discussions
0
Upvotes
1
Know more
101
Total problems solved
82
Easy
19
Moderate
0
Hard
0
Ninja
Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec

Current streak:

0 days

Longest streak:

4 days

Less

More

Achievements
5
Ronin
Topics
Sorting
Math
Trees
+ 2 more
5
Samurai
Topics
Linked List
Arrays
Recursion
+ 2 more
Discussions
Optimize Solution
Interview problems

void pushZerosAtEnd(vector<int> &arr) 

{

    // Write your code here.

    int nonzeroindex=0;

    for(int i=0;i<arr.size();i++){

        if(arr[i]!=0){

            arr[nonzeroindex++]=arr[i];

        }

    }

    while(nonzeroindex<arr.size()){

        arr[nonzeroindex++]=0;

    }

}

profile
sarveshmeshram
Published On 14-Nov-2023
35 views
0 replies
1 upvotes