How To Move Zeroes To End Of An Array ( LeetCode

Sdílet
Vložit
  • čas přidán 3. 02. 2023
  • 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/8eiUmM92Fx563Aen9
    or call us at 8884881203
    Facebook: / thetapacademy
    Instagram: / tapacademy_online
    Linkedin: / 73820805
    Website: www.thetapacademy.com​
    #java #dsa #dsacourse #javadsa #javacourse #datastructure #placement #coder

Komentáře • 27

  • @abhishekmane23
    @abhishekmane23 Před rokem +3

    God levels teaching sir✨

  • @user-ni4bo4pi8p
    @user-ni4bo4pi8p Před 7 měsíci +2

    Brilliant no words left to say about your explanation.....thanks a lot sir for helping us....ur codings are so easy to understand.....

    • @GyaniBaba434
      @GyaniBaba434 Před měsícem

      have you run that ?? how printed that ??

  • @jean-paulboga8189
    @jean-paulboga8189 Před 6 měsíci

    you teach with confidence and like that....thanks for the great explanation.

  • @maheshbhabad9579
    @maheshbhabad9579 Před 6 měsíci +1

    nice bruhhhhhhhh concept bhi clear hui or logic bhi

  • @rupeshpatil6957
    @rupeshpatil6957 Před měsícem

    Thanks Brother

  • @namratasingh711
    @namratasingh711 Před 8 měsíci

    Awesome explanation 👏

  • @sangameshamaravati8356
    @sangameshamaravati8356 Před 5 měsíci

    Awesome no words just ❤❤❤

  • @lucbernado8270
    @lucbernado8270 Před rokem +1

    Good illustration

  • @reddevilbeast15
    @reddevilbeast15 Před 10 měsíci +2

    Great explanation Sir keep it up yrr

  • @GyaniBaba434
    @GyaniBaba434 Před měsícem

    How you have printed output, there is not print statement in your program , and without if I am running nothing getting

  • @AjitKumar-gn1se
    @AjitKumar-gn1se Před 5 měsíci

    Maza aagaya . Thanks 🙏

  • @TuhiBhowmik
    @TuhiBhowmik Před 4 měsíci

    please make more such videos. your videos are the best for new commers

  • @hari7110
    @hari7110 Před 6 měsíci

    bro the way you teach is just awesome!🤩

  • @_sarthakmisal
    @_sarthakmisal Před 5 měsíci

    The intro is quite bright whenever video changes my eyes got shrunk lol

  • @punyakeerthana4522
    @punyakeerthana4522 Před měsícem

    We can't do it , by counting zeros and creating an new array in that we are keeping 1st non-zeros and after zeros

  • @ayushmantripathi7189
    @ayushmantripathi7189 Před 12 dny

    use i and j instead of nz z it will make complicated to understand

  • @user-ly6cw1gl1w
    @user-ly6cw1gl1w Před 11 měsíci +6

    what if first element is non zero?

    • @jagratsahoo6885
      @jagratsahoo6885 Před 11 měsíci +1

      Then it enter the else statement

    • @bhumikabansal6022
      @bhumikabansal6022 Před 10 měsíci

      then it will run the if part and till we get the zero element then nz pointer will move the one forward

    • @rahulb9205
      @rahulb9205 Před 10 měsíci +3

      @@bhumikabansal6022 how will zero pointer know that it is pointinh zero

  • @213sudhan8
    @213sudhan8 Před 4 měsíci +1

    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😢

    • @GyaniBaba434
      @GyaniBaba434 Před měsícem

      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

  • @user-yq8bf3xv8p
    @user-yq8bf3xv8p Před 6 měsíci +4

    how will the zero pointer know that it is pointing towards the zero element

    • @snehaldhindle9110
      @snehaldhindle9110 Před 5 měsíci +1

      Please check your " if condition " ...... if(nums[nz]!=0)
      there is no need of checking where the zero pointer points.

    • @sailisurve4603
      @sailisurve4603 Před měsícem

      Why but