Lecture 20: Solving LeetCode/CodeStudio Questions [Arrays]

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 706

  • @Lucrativesummon
    @Lucrativesummon 2 года назад +361

    Due to your help and guidance I have cleared Amazon SDE-1's coding round . Wish me luck for the interview .

  • @rahulrastogi5312
    @rahulrastogi5312 3 года назад +411

    Feedback: Again I'm saying problem solving is this course's speciality which no other yt channel or resource has ..lage raho Bhaiya ji...sath me hain bilkul aapke 💯❤️

  • @durgashreenv8426
    @durgashreenv8426 Год назад +4

    32:50 for(int j=i; j

  • @aayushkhurana7810
    @aayushkhurana7810 3 года назад +70

    Present bhaiya . What you said about this course before start is Turning out to be 100 percent true . Keep going bhaiya. You are like our professor from money heist.

  • @KunalKumar-tp1cc
    @KunalKumar-tp1cc 2 года назад +20

    25:44 Homework code:
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    int i=0, j=0, k=0;
    vector nums3;
    while(i

    • @amanranjan2684
      @amanranjan2684 Год назад

      thx bro

    • @Avinas_h_7
      @Avinas_h_7 Год назад +1

      thx

    • @omprakashtiwari1412
      @omprakashtiwari1412 11 месяцев назад +2

      There is mistake in this inside while loop the condition for i should be i

    • @calisthenics5247
      @calisthenics5247 9 месяцев назад

      ​@@omprakashtiwari1412No bro if you look at the question value of m denotes the number of elements present in nums1 excetpt the empty space denoted by zero

    • @tusharsoni2450
      @tusharsoni2450 6 месяцев назад +1

      what's the need of k iterator in this?

  • @nacxxj7184
    @nacxxj7184 3 года назад +20

    Personally a JS Learner, Learned C++ amd loved it, but there were less problem solving focused lectures in RUclips. This playlist of DSA series fullfills the issue. Thnx vaiya

  • @yashsonune4391
    @yashsonune4391 2 года назад +27

    this playlist is destined to change the life of upcoming undergrads. Really thank you for what you have done for the cs
    community.

  • @prathamsharma5190
    @prathamsharma5190 Год назад +6

    solved 2 questions of arrays first time by myself...thankx alot to u man this playlist is really a gem!

  • @rahulgoswami1161
    @rahulgoswami1161 2 года назад +80

    Small correction bhaiya
    23:37 At line no - 32 it should be arr3[k++] = arr2[j++]; instead of arr2[k++] = arr2[j++];

    • @abhishekgaurav6928
      @abhishekgaurav6928 Год назад

      yes

    • @fuasteriskk
      @fuasteriskk Год назад +1

      yes i noticed it too but still the code ran flawlessly

    • @ankitbalotiyad-5915
      @ankitbalotiyad-5915 Год назад +3

      because array1 is larger then array2 here and counter consider i

    • @IT__AKASHSHUKLA
      @IT__AKASHSHUKLA Год назад

      yes you are right

    • @priyanshkumar17
      @priyanshkumar17 Год назад

      ​@@fuasteriskkbecause the second loop didn't get executed for that particular sample test case

  • @aryanshah6393
    @aryanshah6393 2 года назад +14

    Bhai Yrr you totally nailed it.....All the questions asked in my Nagarro and TCS interview is from your series........Thanks Bhai
    :)

  • @musqitonebeats2129
    @musqitonebeats2129 2 года назад +18

    25:44 Homework, it is self explanatory
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    int i=0;
    int j=0;
    vectorans;
    while(i

  • @virajdeshpande9821
    @virajdeshpande9821 2 года назад +60

    Time Stamp 25:44 Re: Homework
    The way to think about the solution is that we will have to do a reverse sorting.
    We initialize k=m+n-1 as that will be the last location of nums1.
    We will keep checking for the greater element of the two arrays(i=m-1,j=n-1) and insert the values.
    nums1 = [1,2,3,0,0,0], m = 3
    nums2 = [2,5,6], n = 3
    nums1 = [1,2,3,0,0,0]
    | |
    i k
    nums2 = [2,5,6]
    |
    j
    nums2[j]>nums1[i] thus nums1[k]=6
    k and j are decremented.
    nums1 = [1,2,3,0,0,6]
    | |
    i k
    nums2 = [2,5,6]
    |
    j
    nums2[j]>nums1[i] thus nums1[k]=5
    k and j are decremented.
    nums1 = [1,2,3,0,5,6]
    | |
    i k
    nums2 = [2,5,6]
    |
    j
    We keep following up this procedure and we get the desired reult.
    void merge(vector& nums1, int m, vector& nums2, int n) {
    int i=m-1,j=n-1,k=m+n-1;
    while(i>=0&&j>=0)
    {
    if(nums1[i]>nums2[j])
    {
    nums1[k]=nums1[i];
    i--;
    k--;
    }
    else
    {
    nums1[k]=nums2[j];
    j--;
    k--;
    }
    }
    while(i>=0)
    nums1[k--]=nums1[i--];
    while(j>=0)
    nums1[k--]=nums2[j--];
    }

    • @shreetejsanap1706
      @shreetejsanap1706 2 года назад +2

      Good Work Brother

    • @rahultaparia1206
      @rahultaparia1206 2 года назад

      Thank you brother

    • @rangamdeka6178
      @rangamdeka6178 2 года назад +2

      Why can't we do that problem the way we did the normal merge 2 sorted arrays problem in the video?

    • @aditya-9431
      @aditya-9431 2 года назад +1

      @@rangamdeka6178 It can be done. Space complexity is increasing. ig, it was given in the solution section of leetcode.

    • @priyanshurawat5245
      @priyanshurawat5245 2 года назад

      @@aditya-9431 yess so true...

  • @artifice_abhi
    @artifice_abhi 2 года назад +20

    In the second question merge two sorted arrays - 12:48 I used this approach
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    // removing zeroes
    for(int i = 0; i

    • @madanmohanpandey132
      @madanmohanpandey132 Год назад

      Very good approach

    • @BindassMHV
      @BindassMHV Год назад +1

      apni buddhi apne pas rakh bhaiya ko samjhane de

    • @rajnigarg8601
      @rajnigarg8601 Год назад

      Ye bhi sahi hai bs time complexity zyada hai iski

    • @ashishvinod2193
      @ashishvinod2193 Год назад

      O(n+m) hogai approach sahi hai but time complexity badh gai compare to o(n)

    • @ihateracistandblackpeople4272
      @ihateracistandblackpeople4272 Год назад

      ​@@ashishvinod2193 bhai sorting ki bhi T.C. add hogi n + m to sitf shuru k 2 loop ki h

  • @atulkumar2417
    @atulkumar2417 3 года назад +5

    Bhaiya ab pata nahi but jyada maja ata hai approach ka intuition thora thora ane lagta hai . Thank you ❤️

  • @vijaymaurya9755
    @vijaymaurya9755 3 года назад +13

    Maja aa gaya dekh ke bhaiya♥️ U r video improving my logic building …….. in this video i am able to think brute force approch ……thank you bhaiya ♥️

  • @raj3718
    @raj3718 3 года назад +3

    What a consistency bhiyaa
    Aakho me neend ye phir bhi video bana rahe ho 🔥🔥🔥🔥
    Explanation is on top

  • @asmitsrivas
    @asmitsrivas 3 года назад +20

    Lecture 20 - completed
    Homework 26:38
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    int i = 0, j = 0,k=0;
    int nums3[m+n];
    while(i

    • @I_Anupam_Pandey
      @I_Anupam_Pandey 3 года назад +9

      This way we can solve but in question, it is given without making any third vector or array. do you know any other method

    • @GauravJadhav-ml2my
      @GauravJadhav-ml2my 2 года назад

      hii, last mein for loop kyu lagaya hai

    • @aazamali2081
      @aazamali2081 2 года назад +2

      @@GauravJadhav-ml2my kiuki usne bola h ki answer nums1 m store krna h isliye

    • @godl_disaster611
      @godl_disaster611 Год назад +2

      just use single loop
      int mergesort = m ;
      for(int i = 0 ; i < n ; i++){
      nums1[mergesort++] = nums2[i];
      }
      And sort the array 😁

  • @srajittanwar636
    @srajittanwar636 3 года назад +4

    Present sir ,array toh sab padhate h but bhaiya array ka postmortem karte h. Thank you bhaiya.Roz bas ese hi video ane dijiye.

  • @AmanSharma-tn3dy
    @AmanSharma-tn3dy 3 года назад +7

    Question1:
    void reverseArray(vector &arr , int m)
    {
    // Write your code here.
    int i = m+1;
    int j = arr.size()-1;
    int temp = -1;
    while(i

  • @she_Reads1908
    @she_Reads1908 2 года назад +6

    you're the best sir. I really had a hard time learning coding and solving problems. But you have made everything so easy.

    • @dhruvikmevada5155
      @dhruvikmevada5155 2 года назад

      if at the non zero index value is non zero then this code will be wrong
      example:arr[]={2,0,1,2,0,3,0}
      solution:
      #include
      #include
      using namespace std;
      vector reverse(vector,int);
      void print(vector);
      vector reverse(vectorv,int i){
      for(int j=i+1;j

    • @dhruvikmevada5155
      @dhruvikmevada5155 2 года назад

      you are so cute and beautiful🙂😊

    • @KaiCenatLOLClips
      @KaiCenatLOLClips 2 года назад +4

      @@dhruvikmevada5155 bsdk padhle
      \

    • @shi-nee7966
      @shi-nee7966 2 года назад +3

      @@KaiCenatLOLClips bhai bande ne pehle ans bhi reply mai kiya fir likha 🤣

  • @I_Anupam_Pandey
    @I_Anupam_Pandey 3 года назад +217

    Feedback: Kindly also discuss the solution of the previous class homework in the next video
    hit like if you agree

    • @15priyanshupratapsingh24
      @15priyanshupratapsingh24 2 года назад +5

      what is the point of giving homework if we have to discuss it in the lecture

    • @111rhishishranjan2
      @111rhishishranjan2 2 года назад +11

      @@15priyanshupratapsingh24 because kid every problem can be solved in many ways ,By seeing best solution u get better idea, u can compare with your solution to see which code is better in terms of length and time complexity and in this way u will learn a lot

    • @abdulrehmaan153
      @abdulrehmaan153 Год назад +1

      bhai jaake discussion me check krona yaar

    • @shiv.shankar
      @shiv.shankar Год назад

      @@abdulrehmaan153 Kaunse discussion mai? If you are talking about Discord ka discussion then wahaan pe kaunse channel mai discuss hoti hai homework problems?

    • @bossnation8921
      @bossnation8921 Год назад

      ​@@shiv.shankarAre coding platform ke discussion me

  • @atulkumarpandey3342
    @atulkumarpandey3342 3 года назад +1

    wah bhaiya samajh aa gya bahut asan ho gya aapke padhane ke baad isse pahle aisa lagta tha ki coding mere liye bani hi nhi hai lekin ab mja aa rha hai.Thanks bhaiya ❤

  • @laveshkhairajani5578
    @laveshkhairajani5578 2 года назад

    Q MERGE TWO SORTED ARRAYS
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {

    for(int i=0;i

  • @yashmishra47
    @yashmishra47 3 года назад +35

    You teach really well , really waiting for the trees data structures as that is my weakest part and I really struggle to solve even a single tree question.

    • @CodeHelp
      @CodeHelp  3 года назад +63

      ekdum makhhan lagega trees toh, jab karwaenge

    • @ashishtomer9962
      @ashishtomer9962 3 года назад +1

      @@CodeHelp ​ Thanks for all the content and this course.
      One request though: Please don't post content everyday. It's getting harder to keep up. Every other day is fine.

    • @amitshukla2268
      @amitshukla2268 3 года назад +2

      bhai love bhaiya ne kha hai iss pace se chlega tabhi jake 17 march tak course khtm hoga so plz chalne do :)

    • @kailashdaata8610
      @kailashdaata8610 3 года назад +1

      @@CodeHelp plz try to continue language independent course as you are doing now,. so if somebody wants to solve in java/python they can do.

    • @259_parthpatidar9
      @259_parthpatidar9 3 года назад

      @@ashishtomer9962 din raat ek krdo

  • @saumitramuley5170
    @saumitramuley5170 3 года назад +7

    Thank you bhaiyya for couse and giving motivation and confidance This couse is just next level far better than any cource in india ❤️

  • @prasadprashantb.4001
    @prasadprashantb.4001 2 года назад

    Iss chanel ko jo cheez sabse alag aur ekdum khaas aur effective banati hai vo hai real life problem solving practice jonki aur koi yt channel nhi krta that's the big+++ for this channel.... Keep it up bhaiya 👏👏🙌❤❤

  • @vijaiganeshh1346
    @vijaiganeshh1346 9 месяцев назад +1

    28:48 Use bubble sort and if arr[j] == 0 swap this moves zeroes to last

  • @BharatJaidiya-kw8nl
    @BharatJaidiya-kw8nl 3 месяца назад

    bhai apka samjhane ka tarika kuch aisa hai jaise ki nurssary ke bache ko abcd sikhaya ja rha hai , op explanation , all clear , love babbar OP

  • @rajvishwakarma5672
    @rajvishwakarma5672 2 года назад +19

    void merge(vector& nums1, int m, vector& nums2, int n) {

    for( int i=m, j=0; i

  • @AmanSharma-tn3dy
    @AmanSharma-tn3dy 3 года назад

    mja sa aa gya bhiya aaaj muje apka solution dekhne ki jrurt hi nhi pdi, khud se hi solve kr diye, abbb dhere dhere lg rha h amazon microsoft jase m selection ho jaeyga.. thanku you bhiya.

  • @dhir_tech
    @dhir_tech 3 года назад

    solid logic and industry level ki coding experience de rhe hai aap, paisa deke bhi nhi milta bhaiya , i mean kon Amazon ki job chhor ke hmko padhayega , u r great bhaiya time diya apne hum juniour ko thanku so much

  • @ariesgaming4580
    @ariesgaming4580 Год назад +1

    Reverse array
    vectorans;
    int i=0;
    int k=arr.size()-1;
    while(i

  • @balmukundtiwari7963
    @balmukundtiwari7963 3 года назад +26

    Kindly check line no 26 @ 25:35
    it should be arr3[k++]=arr2[j++];

    • @AaBb-zd5gk
      @AaBb-zd5gk 3 года назад

      Yes baad me correct kr lia bhaiya ne

    • @priyamtiwari391
      @priyamtiwari391 2 года назад

      yup this is a mistake

    • @sureshmakwana8709
      @sureshmakwana8709 2 года назад

      @@AaBb-zd5gk nope nahi kiya

    • @sureshmakwana8709
      @sureshmakwana8709 2 года назад

      @@priyamtiwari391 yeah I wrote code by myself then saw on screen that y has he written that😂

  • @Aditya-ic5vo
    @Aditya-ic5vo Год назад +2

    25:44 Homework
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    int i=0,j=0,k=0;
    vector nums3=nums1;
    while(i

  • @NotTheFakeRahul
    @NotTheFakeRahul 2 года назад +1

    19:50
    we can add INT_MAX at the end of both arrays, this way we can avoid writing two extra while loops for remaining elements!!
    thank you Babbar Bhaiya for teaching us so well!

    • @yashahuja1550
      @yashahuja1550 Год назад +1

      how? bro can u explain

    • @AbhinavPt
      @AbhinavPt 10 месяцев назад

      but then you will also end up adding the int_max values, in the last position in the new array, since they are also elements of your array

  • @divyeshmavadiya6310
    @divyeshmavadiya6310 3 года назад +1

    Ek dum se maja aa gaya bhaiya and End sem chal rahe he but...... aap lage raho hum time nikal ke bhi kar lege bus aapki video aani chahiye ......................Love from Gujarat

  • @sachinaghera8189
    @sachinaghera8189 2 года назад +43

    23:20 there is error. It should be
    arr3[k++]=arr2[j++];

  • @amitshukla2268
    @amitshukla2268 3 года назад +1

    Bhaiya kuch samay baad inn videos ke views millions me honge , thnx a lot bhaiya 🔥🔥🔥

  • @vivekrai2305
    @vivekrai2305 3 года назад +29

    Bhaiya please make more nd more videos on only problem solving....
    Becoz these videos helps to improve logics and also tells that how to approach a problem and how to think about particular problem ❤️❤️

  • @_washim_45
    @_washim_45 2 года назад +2

    H.W. 25:44
    void merge(vector& nums1, int m, vector& nums2, int n) {
    nums1.resize(m);
    for(int i=0;i

  • @saketsrivastava1424
    @saketsrivastava1424 3 года назад +5

    Thank you for this placement series Bhaiya
    We're learning and enjoying a lot.

  • @devanshsk7222
    @devanshsk7222 3 года назад +1

    Solved all questions in 1st try by myself.
    Ab to confidence aane laga h.

  • @randomavghuman
    @randomavghuman 11 месяцев назад +3

    for second question, just add the nums2 to nums1 after nums 1 ends, then simply use insertion sort in the whole nums 1, itll give the fastest result in leetcode. here we dont make another array and convert nums1 to that array so it does save time
    class Solution {
    public:
    void merge(std::vector& nums1, int m, std::vector& nums2, int n) {

    for(int i=0;i= 0; j--) {
    if (nums1[j] > temp) {
    nums1[j + 1] = nums1[j];
    } else {
    break;
    }
    }
    nums1[j + 1] = temp;
    }

    }
    };

    • @IslamEcho
      @IslamEcho 11 месяцев назад +1

      Thanks Brother

    • @IslamEcho
      @IslamEcho 11 месяцев назад

      you can also try this one
      class Solution {
      public:
      void merge(vector& nums1, int m, vector& nums2, int n) {
      int i = m - 1;
      int j = n - 1;
      while (i >= 0 && j >= 0) {
      if (nums1[i] > nums2[j]) {
      nums1[i + j + 1] = nums1[i];
      i--;
      } else {
      nums1[i + j + 1] = nums2[j];
      j--;
      }
      }
      while (j >= 0) {
      nums1[j] = nums2[j];
      j--;
      }
      }
      };

  • @bananipanja2704
    @bananipanja2704 3 года назад +4

    I never comment on Bhaiya's videos as I'm currently on video 9 (yeah lagging behind) but today i had to....kyunki kal raat sapne mein bhi dekh rhi hoon mein code kar rhi hoon(for loop ye sabb)... pta nhin Love Bhaiya comment dekhenge ya nhin...But had to share this... thanks bhaiya itna accha dsa course kliye❤️❤️❤️

    • @CodeHelp
      @CodeHelp  3 года назад +6

      Sapne me bhi DSA wow dedication 😳

    • @bananipanja2704
      @bananipanja2704 3 года назад

      @@CodeHelp 😂😂😂...ss le rhi hoon aapke reply ka🥺...thanks a lot

    • @codusiast5401
      @codusiast5401 3 года назад +5

      @@bananipanja2704 phir compilation error aate he neend khul gayi hogi 😅😅

  • @shashinibhat8989
    @shashinibhat8989 3 года назад +5

    I was looking for a well structured dsa course and this is helping a lot❤

  • @kishansingh6510
    @kishansingh6510 2 года назад +2

    Q1 Reversing an array after m position -->
    #include
    #include
    using namespace std;
    vector reverse(vectorv){

    int s=v.front()+2,e=v.size()-1; //here m=3 i.e., change array after 3rd position

    while(s

  • @parthshinde3636
    @parthshinde3636 2 года назад

    void reverseArray(vector &arr , int m)
    {
    // Write your code here.
    int start=m+1;
    int end=arr.size()-1;
    while(start

  • @kamla783
    @kamla783 3 года назад +1

    Solving Questions at Leetcode && at Codestudio has Motivate Me alot 🔥🔥

  • @sciencestreamers8509
    @sciencestreamers8509 2 года назад

    Yaar kitna achey se smjhate ho aap 😀

  • @riyaprajapati9951
    @riyaprajapati9951 5 месяцев назад

    Done!!❤
    This is the best course i have ever seen!! Thank you soo much sir!

  • @tanmoybiswas6048
    @tanmoybiswas6048 Год назад

    Maza agaya bhaiya. im in 4th sem right now from kolkata. im from a tier 4 college ,watching your lectures and solving problems to make my base strong from scratch. thanks for everything you did. and wish you well for your health. waiting for your web dev videos. im making promise that im gonna be more consistent and get myself placed in a good company. baas apka saath ho and i will follow your guided path. pranam lijiye bhaiya.🙏

  • @lokeshwarprasad9614
    @lokeshwarprasad9614 Год назад

    You teach really well ,Really thank you for what you have done for the cs
    community.

  • @aaravkumar1308
    @aaravkumar1308 3 года назад

    U are maahan bhaiya 🔥🔥 aisa couurse paise deke bhi naa milta 🥺🥺🔥🔥

  • @ArchitYadav-vm3tv
    @ArchitYadav-vm3tv Год назад

    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    for(int i=0;i

  • @manaskumarpanda3343
    @manaskumarpanda3343 3 года назад +1

    Bhaiya BINARY SEARCH aap se padatha to aaj practical exam mein ka 45 min ka paper ko 6 min mein kardia
    LOVE YOU BRO.❤❤

  • @vinaysharma6646
    @vinaysharma6646 3 года назад

    best content bhaiya..
    bhot bacho ki good wishes aap k sath h

  • @umashankerpanday77
    @umashankerpanday77 3 года назад +1

    Bs bhaiya ese basic se utha ke le chalo thanku very much bhaiya ..........I am from tier 3 college but from your course I will crack the off campuses.....
    Bs bhaiya level basic se hi leke chlna

  • @radhikakhandelwal4047
    @radhikakhandelwal4047 3 года назад

    Bhaiya dekh li video!
    Mazza aa gaya.....
    Homework done!

  • @Engineering_Unlocked
    @Engineering_Unlocked Год назад +1

    to all the guys who thinks why we done use use reverse here we can use that also but for understanding us the concepts bhaiya told us that we can also used reverse(a[m+1],a[end]);

  • @_SahilShah
    @_SahilShah 3 года назад +2

    Marked the attendance!💯
    Commeting for better reach!👊🏽

  • @mohammadmuzaffarhyder8828
    @mohammadmuzaffarhyder8828 3 года назад

    Bhaiya aap macha rahe ho ,dsa ki duniya ka kingkong

  • @babarockgaming8967
    @babarockgaming8967 Год назад

    Thank you bhaiya
    Deep down my heart u r one of my favourite teacher of my life

  • @abhijitmondal2172
    @abhijitmondal2172 3 года назад

    vaiya aj to maja agaya...out of 3 i solved 2question.. also i build the logic...thank you so much for your priceless effort.. lots of love from kolkata.

  • @MohanSingh-rj3td
    @MohanSingh-rj3td 2 года назад

    coding is beauty when someone like yyou is there to help us.

  • @saurabhsinha5639
    @saurabhsinha5639 2 года назад +2

    Bhaiya kyuki ye vector h to simply ye bhi kr sakte h kya?
    int j=0;
    for(int i=m;i

  • @akashkumaryadav1827
    @akashkumaryadav1827 Год назад

    bhiayaa bahut pyra solution tha last wale question ka

  • @paramjjethwa8734
    @paramjjethwa8734 2 года назад

    Mastay talent hai yaar superb coding!

  • @BindassMHV
    @BindassMHV Год назад

    Bahut badhiya samjhaya hai bhaiya Love U😍❤❤

  • @BEEMonikaBishnoi
    @BEEMonikaBishnoi 3 года назад +1

    Bhot badhiya bhaiya 🤗🤗 thank you for this consistency.........bhaiya aap morning wale pr soch kr bta dena kya kr rahe ho uska

  • @yashchauhan7221
    @yashchauhan7221 3 года назад +1

    Attendence done will watch after previous video 🔥

  • @vivekr1169
    @vivekr1169 2 года назад

    Bhaiya sach me aapke vajh se samjh gaya itna bas ab practice karna hai thanku bhaiya🙏

  • @BerozgarAt25
    @BerozgarAt25 3 года назад

    hamesha ki tarah ek aur lazwaab video lage raho bhaiyya ham bhi hain bhaiyya

  • @prateekshrivastava2802
    @prateekshrivastava2802 2 года назад +2

    Qn 2 my solution : --
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    for(int i=0;i

  • @prabhpreetsingh8665
    @prabhpreetsingh8665 Год назад

    25:45
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    int i=m-1;
    int j=n-1;
    int k=m+n-1;
    while(j>=0){
    if(i>=0 && nums1[i]>nums2[j]){
    nums1[k]=nums1[i];
    i--;
    k--;
    }
    else{
    nums1[k]=nums2[j];
    k--;
    j--;
    }
    }
    }
    };

  • @daymand22
    @daymand22 2 года назад

    Bilkul maza hi aa gya bhaiya . and i noticed ,i could think of logic immediately.🧡🧡🧡🧡

  • @harshsaxena356
    @harshsaxena356 3 года назад +4

    I Know the video will be awesome as always ❤️

  • @ankushladani496
    @ankushladani496 3 года назад

    Maja aa gaya bhaiya done abhi dekha..👏

  • @bipinyadav5090
    @bipinyadav5090 10 дней назад

    reverse array
    void reverseArray(vector &arr , int m) {
    int s=m+1;
    int e=arr.size()-1;
    while (s

  • @RohitRana-tz2lr
    @RohitRana-tz2lr 2 года назад

    Thanks, bhaiya for solving the problem too.... Great fan of your hard work and dedication

  • @srikanthchivukula4555
    @srikanthchivukula4555 3 года назад +4

    Nice explanation. It would be great if you also make some videos on Low Level design(oops concepts) and design patterns.

  • @aadityavikram6354
    @aadityavikram6354 2 года назад

    ANSWER OF SECOND QUESTION
    Merge 2 sorted arrays:
    void merge(vector& nums1, int m, vector& nums2, int n)
    {
    vectorans;
    int i=0,j=0;
    while(i

  • @poojayadav695
    @poojayadav695 3 года назад

    Attendance ✅
    Videos roj upload kro bhaiya hum dekh rahe h daily videos

  • @_tan2112
    @_tan2112 2 года назад

    All the 20 videos payoff when you are watching 21th and getting each and everything .
    Respect to LOVE BABBER

  • @TanushreeB-e3q
    @TanushreeB-e3q 15 дней назад

    Bhaiya,you are a very good teacher🥳😎

  • @sarthaknirgude
    @sarthaknirgude 2 года назад +1

    (23:28 ) you write arr2[k++]=arr2[ j++] instead of arr3[k++]=arr 2[j++]
    you write arr2 instead of arr3

  • @janhavikothari3983
    @janhavikothari3983 11 месяцев назад

    Move zeros:
    class Solution {
    public:
    void moveZeroes(vector& nums) {
    int i=0;
    int j=0;
    while(i

  • @parassetia4964
    @parassetia4964 3 года назад

    Aagye bhaiya aagye....aane de content...hajm kr lenge...🤤🤤🤤✌✌

  • @ankitpanchal7554
    @ankitpanchal7554 2 года назад

    1st HomeWork done:
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    int i= m;
    int j =0;
    while(j

  • @techtrap4670
    @techtrap4670 2 года назад

    void reverseArray(vector &arr , int m)
    {
    // Write your code here.

    int e=arr.size()-1;
    for(int s=m+1;s

  • @priyanshubasu2092
    @priyanshubasu2092 2 года назад

    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n)
    {
    for(int i=0;i

  • @sy_02_vaibhavavdhut98
    @sy_02_vaibhavavdhut98 8 месяцев назад

    In Question2 -> we can directly add elements of arr2 in arr1 and then simply use sort

  • @oflyrics3477
    @oflyrics3477 2 года назад

    Try this
    For (int i=0;i

  • @ankushladani496
    @ankushladani496 3 года назад

    Present bhaiya... abhi to class chal rahe he afternoon me hi dekh lunga kal ki tarah...
    Video dalte raho gyan batte raho...🤘🤘

  • @prasadprashantb.4001
    @prasadprashantb.4001 2 года назад

    Wahh bhaiyaa mast laga🤘🙌🙌👏❤❤

  • @risavkumarjha6899
    @risavkumarjha6899 Год назад +1

    Thanks, bhaiya for being a really excellent lecture.

  • @avibirla9863
    @avibirla9863 3 года назад

    Maza aa gaya Mere 2 array m ♥️♥️

  • @SACHINYADAV-mm4ke
    @SACHINYADAV-mm4ke 2 года назад

    @CodeHelp - by Babbar
    Ques 2 - Merger sorted array
    class Solution {
    public:
    void merge(vector& nums1, int m, vector& nums2, int n) {
    vector nums3;
    nums3 = nums1;
    int i = 0;
    int j = 0;
    int k = 0;
    while (i

  • @abdulrehmaan153
    @abdulrehmaan153 Год назад +1

    I personally loved the merge two sorted arrays prob coz it made me ponder for a while lot longer and made me look like a fool in front of myself,... a pretty odd comment but it let's me hit off some air and let's others resonate and feel good bout themslvs

  • @rasid_khan
    @rasid_khan 3 года назад +1

    Bhaiya exam khatam hone ke baad 1 week deke 20 videos khatam kar diya...
    Ab saath saath chalenge 🧡🧡🧡
    Thank you for this amazing course🔥🔥🔥🔥🔥

  • @prashantmaurya6868
    @prashantmaurya6868 3 года назад

    Thanku soo muchh bhaiya ya strategy unique aur sabsee bestt hai aap padhai k saath acche platform k questions bhi kara rahe thanku soo much bhaiya #PlacementHogiApni