Move all the negative elements to one side of the array | Arrays | Love Babbar DSA Sheet | Hindi

Sdílet
Vložit
  • čas přidán 20. 08. 2024
  • Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)
    #DataStructuresAndAlgorithms
    #LoveBabbarDSASheet
    #interviewpreparation
    Move all the negative elements to one side of the array solution
    Move all the negative elements to one side of the array Leetcode
    Move all the negative elements to one side of the array C++
    Move all the negative elements to one side of the array Hindi
    Move all the negative elements to one side of the array Hindi
    Checkout the series: 🔥🔥🔥
    👉 Recursion : • Recursion
    👉 Stack and Queue : • Stack And Queue
    👉 Greedy : • Greedy
    👉 Leetcode contests : • Leetcode contests
    👉 Leetcode June Challenge : • Leetcode June Challenge
    👉 Leetcode July Challenge : • Leetcode July Challenge
    LIKE | SHARE | SUBSCRIBE 🔥🔥😊

Komentáře • 72

  • @amitchaudhary7745
    @amitchaudhary7745 Před 2 lety +41

    i think ,you didn't notice that it is asked in the question that order should be preserve

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

      I saw your comment in other video on same problem ( did you find the proper solution yet, I am also trying to find the right video )

    • @learnwithsharmaji223
      @learnwithsharmaji223 Před 2 měsíci

      Exactly

  • @12princepal54
    @12princepal54 Před rokem +4

    But the order of positive and negative numbers will not remain same as before
    is there any way to maintain the order of numbers also withO(1) space complexity

  • @ynfitness07
    @ynfitness07 Před rokem +2

    Given an array of positive and negative numbers, arrange them in an alternate fashion such that
    every positive number is followed by a negative and vice-versa maintaining the order of appearance.
    The number of positive and negative numbers need not be equal. Begin with a negative number.
    If there are more positive numbers, they appear at the end of the array. If there are more negative
    numbers, they too appear at the end of the array.
    Input 1:
    N = 6
    arr[] = {1, 2, 3, -4, -1, 4}
    Output 1:
    arr[] = {-4, 1, -1, 2, 3, 4}

  • @shubamgoswami
    @shubamgoswami Před 3 lety +2

    Inspiration..... Came here from linked in thank you for so much valuable content ❤️ 😊 from this video 📹 permanent viewer💐❤️

  • @sagartaak4017
    @sagartaak4017 Před rokem +3

    nice but have you noticed in example of gfg they maintain the order

  • @jaskamalsingh4436
    @jaskamalsingh4436 Před 3 lety +4

    Valuable content💯
    great learning...

  • @sunnykakrani7830
    @sunnykakrani7830 Před 3 lety +6

    actually there is a pattern in these types of problems when we want to make left side different and right side different .In this question we have to shift negative elements to the left side and positive elements to the right side ,if it is given we have to put all odd numbers first and then all even numbers after OR if it is given we have to put all 0's b before and then after 1's ,So there is a pattern in these type of problems . In these type of problems its better to use partition function of quicksort algorithm.
    Correct me if I am wrong !!

  • @PriyaSingh-co7hm
    @PriyaSingh-co7hm Před rokem +1

    Well explanation thank you mam

  • @S3shubham
    @S3shubham Před rokem +2

    How we can do this problem if we have to maintain the Order of elements
    Ayushiii....?

  • @sakilahmed2911
    @sakilahmed2911 Před rokem

    I really like your teaching when you teach us,,

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

    NICE SUPER EXCELLENT MOTIVATED

  • @Priyew
    @Priyew Před rokem +1

    order maintain is only the problem

  • @omkarjoshi7371
    @omkarjoshi7371 Před 3 lety

    Hey great videos !! came here after your interview. Never stop

  • @rutikbodkeacademy1247
    @rutikbodkeacademy1247 Před 9 měsíci

    nice explanation

  • @premmane9816
    @premmane9816 Před 2 lety +6

    your algorithm is not giving desired output for {-12, 11, -13, -5, 6, -7, 5, -3, -6} this input
    output should be : -12 -13 -5 -7 -3 -6 11 6 5
    but output produced is : -12 -6 -13 -5 -3 -7 5 6 11
    Try it ............

    • @adityatiwari6068
      @adityatiwari6068 Před rokem

      same order ke liye galat ho jaaega

    • @adityatiwari6068
      @adityatiwari6068 Před rokem

      iske liye array bnaa lo pehla pehle saare positive store krao then negative aur uske baad ek for lgaa ke..purane araay ko with every i same kraa do

    • @premmane9816
      @premmane9816 Před rokem

      @@adityatiwari6068 Bhai may sab bhul gaya time huwa bhaut solve karke ,btw thanks 😂

  • @HarshitSharma-cb7dx
    @HarshitSharma-cb7dx Před 3 lety +3

    Hlw Congratulations Ayushi maam for cracking walmart....
    Maam m in my 4 sem and 5 is going to start...
    Currently m completing the love babber sheet and also the apna college DSA serious... It will take 5 months time.
    M also starting a project on Web development ( making a college website) and i have 3 🌟 in cp
    M preparing for a product based company... Only 2 years are left...
    Please can you suggest me something... I've not done any internship yet... 😞

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 3 lety +3

      You are doing great in dsa, for internship, make good projects in any framework in which you want internship in. And then apply on internshala and other sites

    • @HarshitSharma-cb7dx
      @HarshitSharma-cb7dx Před 3 lety +1

      @@AyushiSharmaDSA thanks maam 😊

  • @AmanGupta-cg9tc
    @AmanGupta-cg9tc Před 2 lety +5

    this solution does not maintain order of elements

  • @amitkumaryadav1727
    @amitkumaryadav1727 Před 2 lety +1

    please make a seperete video on code with dry run.

  • @AmanSharma-vb5jl
    @AmanSharma-vb5jl Před 3 lety

    thank a lot ,it was very helpful

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

    But the order is not maintained

  • @mr.shoaibmalik2488
    @mr.shoaibmalik2488 Před 2 lety

    Thank you for great explanation sister👌👌👌👌

  • @jeevankumar.v5018
    @jeevankumar.v5018 Před 2 lety

    Thank you 👍

  • @gulfamraza7745
    @gulfamraza7745 Před 3 lety +1

    Hello mam! I watched your interview with Ankush Sir! I am also learning Flutter. So wanted to ask through which CZcams channels/Course did you learn Flutter. Did you also learn Web Development?

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 3 lety +5

      Net ninjas and mtech viral for flutter, for angular and react - thapa technical and Codevolution

    • @gulfamraza7745
      @gulfamraza7745 Před 3 lety

      @@AyushiSharmaDSA Thanks🙏

  • @AmanSharma-tn3dy
    @AmanSharma-tn3dy Před 2 lety

    thanks miss sharma.

  • @RitiKumari
    @RitiKumari Před 3 lety

    Nice explaination :)

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 3 lety +1

      Thank you Riti 😃

    • @nikhilflautist
      @nikhilflautist Před 2 lety +1

      Aap toh wahi ho didi, Notes waali, Thankyou soo much for your notes.. Also, thankyou ayushi Di for you invaluable Resource. Both of you are great for providing such great stuff for free. Dil se bada waala thankyou..

    • @RitiKumari
      @RitiKumari Před 2 lety +1

      @@nikhilflautist Thankyou ❤️😅

  • @tridibbag6186
    @tridibbag6186 Před 3 lety

    very nice

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

    Heyqqq can i get whole dsa sheet of love babber

  • @shubhasheeshkundu9933
    @shubhasheeshkundu9933 Před 3 lety

    Wow mam अगर आप ऐसे ही रोज 4 क्वेश्चन कराएंगी तो शीट 3 महीने में खत्म हो जाये😊

  • @RAUNAKSINGH-ff1xv
    @RAUNAKSINGH-ff1xv Před rokem +1

    this approach is wrong because the ordering is not correct .

  • @namanshah2688
    @namanshah2688 Před rokem

    we have to maintain the order in which element is appearing therefore your solution would not pass all the test cases

  • @shubh_1999
    @shubh_1999 Před 2 lety

    Good attempt but incorrect Approach. Order is not preserved here. We are expected to preserve order of negatives as well as positives.

  • @surjeetsingh-cp6hn
    @surjeetsingh-cp6hn Před 2 lety

    mam ,what if the array element has one or more zero values.

  • @AkashSharmaSDE
    @AkashSharmaSDE Před rokem

    Mam why can't we do this question with sorting ?

  • @CodeGenius123
    @CodeGenius123 Před rokem

    is sorting also correct?

  • @palakjain2505
    @palakjain2505 Před rokem

    I think it's wrong as the order of elements is not preserved

  • @user-nq7nt1rq9b
    @user-nq7nt1rq9b Před 3 lety

    Hi would you please tell me how is the coding ninjas DSA in python please explain I am in entering in 3rd yr of production engineering kindly waiting for your reply

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  Před 3 lety

      Hi, coding ninjas dsa course in cpp is great, but I don't know about in python. It will be good anyways :)

  • @BTC-World-123
    @BTC-World-123 Před rokem

    What about ordering of elements 😀

  • @2goldenchasma559
    @2goldenchasma559 Před 2 lety

    Didi code thoda massive or big ho jayega but concept samj aa gaya

  • @ghanendrabhardwaj
    @ghanendrabhardwaj Před 3 lety

    Didi, Isme partition bhi use kar skte hai n pivot rakhkar?

  • @ravindrasingh4744
    @ravindrasingh4744 Před 2 lety

    wrong approach..... answer are not matching by following ths algo

  • @tutormaths3637
    @tutormaths3637 Před rokem

    order is not preserved

  • @saranshdhyani3164
    @saranshdhyani3164 Před 2 lety

    Girl where is the order?