How To Move Zeroes To End Of An Array ( LeetCode
Вставка
- Опубліковано 3 жов 2024
- This a Leetcode program and it is asked in many good companies. The program reads as:-
Given an integer array num, move all 0's to the end of it while maintaining the relative order of the non-zero elements.
Note:- you must do this in place without making a copy of the array.
Eg.
Input: nums [0, 1, 0, 3, 12]
Output: [1, 3, 12, 0, 0]
We can use simple swapping algorithms with little twerks.
Let's see how we can solve this program.
For more information, fill out this form: forms.gle/8eiU...
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacad...
#java #dsa #dsacourse #javadsa #javacourse #datastructure #placement #coder
use i and j instead of nz z it will make complicated to understand
you teach with confidence and like that....thanks for the great explanation.
Brilliant no words left to say about your explanation.....thanks a lot sir for helping us....ur codings are so easy to understand.....
have you run that ?? how printed that ??
God levels teaching sir✨
nice bruhhhhhhhh concept bhi clear hui or logic bhi
Thanks Brother
Awesome no words just ❤❤❤
bro the way you teach is just awesome!🤩
have u run that ??
please make more such videos. your videos are the best for new commers
Great explanation Sir keep it up yrr
Good illustration
Awesome explanation 👏
what if first element is non zero?
Then it enter the else statement
then it will run the if part and till we get the zero element then nz pointer will move the one forward
@@bhumikabansal6022 how will zero pointer know that it is pointinh zero
Maza aagaya . Thanks 🙏
The intro is quite bright whenever video changes my eyes got shrunk lol
We can't do it , by counting zeros and creating an new array in that we are keeping 1st non-zeros and after zeros
How you have printed output, there is not print statement in your program , and without if I am running nothing getting
Input Array how i will store and Output Value how should i get(I mean what shall I put inside System. Out. Printl) becoz I got output in Hashcodes😢
same if we are putting and without print statement nothing happening if I am running, Is it false program ?? I am surprised how he got output even without declaring array
how will the zero pointer know that it is pointing towards the zero element
Please check your " if condition " ...... if(nums[nz]!=0)
there is no need of checking where the zero pointer points.
Why but