Intersection of Two Arrays | 4 Approaches | Leetcode 349

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

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

  • @dhairyachauhan6622
    @dhairyachauhan6622 5 месяцев назад +21

    Watching Bhaiya's channel grow from 3k to 30k subs is incredible-both his channel's growth and your knowledge surge have experienced a remarkable 10x boost. As you aim for a million subs, may your journey continue to multiply with success! 🌟

    • @codestorywithMIK
      @codestorywithMIK  5 месяцев назад +1

      Means a lot. Thank you so much ❤❤❤🙏🏻🙏🏻🙏🏻

    • @user-ub2is4rs4x
      @user-ub2is4rs4x 5 месяцев назад

      Insane growth. Its only because of the quality and dedication 👌🏻🔥

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

      what is the name of other channel ?

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

    Because of you sir I have 64 days consistentency in leetcode in 2024

  • @oqant0424
    @oqant0424 5 месяцев назад +1

    POTD DONE
    (10.3.24) ✅✅
    Solved using two approaches on my own
    got two learnings from u
    Thanks ❤❤

  • @vinayjoshi8714
    @vinayjoshi8714 2 месяца назад +1

    Great explanation Bhaiya

  • @shreyaverma6538
    @shreyaverma6538 5 месяцев назад +2

    Many congratulations bhaiyaa🎉..keep growing..your stories are just too good.. leetcode became easy because of you🥺

  • @gauravbanerjee2898
    @gauravbanerjee2898 5 месяцев назад +1

    Thanks a lot bhaiya question easy hota hai fir v kuch naya sikha hi dete ho aap ❤❤

  • @aadarshpandit2929
    @aadarshpandit2929 5 месяцев назад +1

    Thank you sir. For discussing all approaches with code ❤

  • @ArjunSaxena-wl3qs
    @ArjunSaxena-wl3qs 5 месяцев назад

    :) Python
    class Solution:
    def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
    intersection = set(nums1).intersection(set(nums2))
    return list(intersection)

  • @utkarshsahay9908
    @utkarshsahay9908 5 месяцев назад +1

    class Solution {
    public:
    vector intersection(vector& nums1, vector& nums2) {
    sort(nums1.begin(),nums1.end());
    sort(nums2.begin(),nums2.end());
    vector ans;
    unordered_set st;
    int i = 0,j = 0;
    while(i < nums1.size() && j < nums2.size()){
    if(nums1[i] < nums2[j]) i++;
    else if(nums1[i] > nums2[j]) j++;
    else{
    if(st.find(nums1[i]) == st.end()){
    st.insert(nums1[i]);
    ans.push_back(nums1[i]);
    }
    i++;
    j++;
    }
    }
    return ans;
    }
    };❤❤

  • @user-ub2is4rs4x
    @user-ub2is4rs4x 5 месяцев назад

    Thanks a lot for multiple approaches. Your efforts are clearly seen in videos.
    Congratulations on 31k subs

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

    Thank you so much sir for all the approaches ❤
    One thing sir
    When i was approaching other's code on LeetCode discussion I did encounter a solution consisting of the same 2 pointer approach but for removing the duplication the algorithm used unique and erase function. Sir if possible please provide a dry run how this two functions work.❤

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 5 месяцев назад +1

    Well explained understood 🎉❤

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

    please came up with "Remove Outermost Parentheses" solution with several approaches. Eagerly waiting.

  • @rajeevyadav4223
    @rajeevyadav4223 5 месяцев назад +1

    nice

  • @RanjeetKumar-tl2nd
    @RanjeetKumar-tl2nd 5 месяцев назад

    Please complete the recursion series sir❤

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

    Sir please start explaining leetcode contest questions also

  • @tutuimam3381
    @tutuimam3381 5 месяцев назад +1

    ❤❤❤❤❤❤

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

    thanks for the explanation but ,
    can we solve it without using Hash set ??and by just using Arrays?

  • @pranavarora3456
    @pranavarora3456 5 месяцев назад +1

    hi, can you please explain 4th question of todays lc contest?

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

    Legend 🔥

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

    ❤❤❤

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

    sir isme runtime error kaise aa rha haii??
    sets;
    sort(nums2.begin(),nums2.end());
    for(auto it: nums1){
    auto x = lower_bound(nums2.begin(),nums2.end(),it)-nums2.begin();;
    if(it==nums2[x])s.insert(it);;
    }
    vectorans;
    for(auto it:s)ans.emplace_back(it);
    return ans;

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

    class Solution {
    public:
    vector intersection(vector& nums1, vector& nums2) {
    sort(nums1.begin(),nums1.end());
    sort(nums2.begin(),nums2.end());
    vector ans;
    int i = 0,j = 0;
    while(i < nums1.size() && j < nums2.size()){
    if(nums1[i] < nums2[j]) i++;
    else if(nums1[i] > nums2[j]) j++;
    else{
    ans.push_back(nums1[i]);
    while(nums1[i] == nums1[i+1] && i < nums1.size()-1) i++;
    while(nums2[j] == nums2[j+1] && j < nums2.size()-1) j++;
    i++;
    j++;
    }
    }

    return ans;
    }
    }; Why am I getting Runtime error PLEASE HELP

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

    I want one suggestion is watching your videos solutions and doing worth it or should I try of my own

    • @codestorywithMIK
      @codestorywithMIK  5 месяцев назад +1

      Please always always try from your own in the beginning.
      And if you are stuck, then don’t give more than 45 minutes on a problem.
      Then you can watch and understand the intuition from my video and then implement on your own.
      Also, always try to understand multiple approaches if possible

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

      @@codestorywithMIK ok thanks mostly I'm not able to solve of my own and stucks everytime from now I'll try again

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

    I am very new to dsa please help me what to watch and start with dsa concepts +practical can u please rearrange videos for beginners

    • @codestorywithMIK
      @codestorywithMIK  5 месяцев назад +1

      Hope this helps ❤️
      Guidance | Q& A | Part-1 | Getting Started with DSA ? | Road Map
      ruclips.net/video/2Jshfog1ETg/видео.html

    • @kaifshaikh358
      @kaifshaikh358 5 месяцев назад +1

      @@codestorywithMIK thanks Mik but need structure approach plzz Like series of videos to watch

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

      Let me plan this soon

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

    Bhaiya i have some doubt how can i discuss with u personall?

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

    Bhaiya abhi DSA start nahi Kiya abhi Web development seekh Raha hoon (JavaScript). Kya mujhe DSA JavaScript se start karna chahiye ya aap bata do ❤

    • @codestorywithMIK
      @codestorywithMIK  5 месяцев назад +1

      Yes you can do DSA with JS too.
      But I would suggest to continue dev with JS and practice DSA with C++ or JAVA

  • @user-dr6zr2uo7c
    @user-dr6zr2uo7c 5 месяцев назад

    1st view

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

    First viewer ❤❤