Leetcode 283. Move Zeroes

Sdílet
Vložit
  • čas přidán 9. 07. 2024
  • Leetcode 283. Move Zeroes
    leetcode.com/problems/move-ze...
    My contact details
    Instagram :- / frazmohammad
    Connect with me on LinkedIn :- / mohammad-f-bb4886157
    Telegram Group t.me/LeadCoding
    FREE INTERVIEW PREPARATION SERIES • Free Interview Prepara...
    You can practice for coding interview from here
    Leetcode Hard :- • Hard
    Leetcode Medium :- • Medium
    Leetcode Easy :- • Easy
    I am Mohammad Fraz , a final year Engineer at DTU and I create content for Coding and technical interviews for FAANG. I explain the intuition to solve Data Structure and Algorithm Questions from leetcode and other platforms. I also cover interview experiences for FAANG and other tech giants. You will also find lectures on the frequently asked interview questions.

Komentáře • 17

  • @coding4u585
    @coding4u585 Před rokem

    Thank you sir.

  • @8885664452
    @8885664452 Před rokem +1

    Great explanation 👌

  • @ratnasanjay
    @ratnasanjay Před 2 lety

    Thankyou bhaiya for this session

  • @neelasatyasai6852
    @neelasatyasai6852 Před rokem

    i enjoing this series

  • @mohdsaadalikhan7209
    @mohdsaadalikhan7209 Před 3 lety

    how could we solve the follow-up part of this ques?

    • @jsuryakt
      @jsuryakt Před 2 lety +2

      You can remove the while loop and make the nums[i] = 0 after nums[j++] = nums[i] and only when i !=j
      So it'lll be like
      if nums[i] != 0:
      nums[j] = nums[i]
      if i != j:
      nums[i] = 0
      j += 1

  • @vansh9857
    @vansh9857 Před rokem

    What if the elements were not sorted like 1 3 12 what if they were 0,3,1,0,12 how do we sort them after

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

    Please provide a video in Hindi

  • @vaishnavirathore5579
    @vaishnavirathore5579 Před rokem

    class Solution {
    public void moveZeroes(int[] nums) {
    int a[]=new int [nums.length];
    int k=0,count=0;
    for(int i=0;i

  • @ankitkumarghosh462
    @ankitkumarghosh462 Před 3 lety

    else
    {
    nums[j]=0;
    j++;
    }
    why this gives wrong answer

    • @mohammadfraz
      @mohammadfraz  Před 3 lety

      Can you send full code ?

    • @ankitkumarghosh462
      @ankitkumarghosh462 Před 3 lety

      @@mohammadfraz yes
      class Solution {
      public:
      void moveZeroes(vector& nums) {
      int n = nums.size();
      int j=0;
      for(int i =0;i

    • @mohammadfraz
      @mohammadfraz  Před 3 lety

      @@ankitkumarghosh462
      Okay , take an example and try to dry run it in your code you will find the problem

    • @ankitkumarghosh462
      @ankitkumarghosh462 Před 3 lety

      @@mohammadfraz okkkkk

    • @satyamsingh3
      @satyamsingh3 Před rokem +1

      @@ankitkumarghosh462 did you get it?