Group Anagrams | Print Anagrams Together | Hashing | Leetcode DSA series | Hindi

Поділитися
Вставка
  • Опубліковано 27 вер 2024
  • This is the video under the series of DATA STRUCTURE & ALGORITHM in a HASHING Playlist. We are going to solve the problem "Group Anagrams" from Leetcode which is solved by using a vector, map in c++.
    Join My Telegram channel for more Updates: telegram.me/he...
    Given an array of strings strs, group the anagrams together. You can return the answer in any order.
    An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
    Input: strs = ["eat","tea","tan","ate","nat","bat"]
    Output: [["bat"],["nat","tan"],["ate","eat","tea"]]
    ----------------------------------------------------------------------------------------
    Group Anagrams: leetcode.com/p...
    Print Anagrams Together: practice.geeks...
    code in This Video: github.com/Pri...
    Pdf in this video: github.com/Pri...
    ----------------------------------------------------------------------------------------
    *Follow me *
    LinkedIn► / iamprince
    Facebook► / helloworldofficials
    Instagram► / helloworldbyprince
    Twitter► / prince_king_
    Telegram► telegram.me/he...
    ----------------------------------------------------------------------------------------
    ►Our Playlists on:-
    ►Competitive Programming: • How to start Competiti...
    ►C++ Full Course : • L-01 || Introduction a...
    ►Algorithms: • L-01 || Prefix Sum Arr...
    ►Data Structure: • Data Structures with C...
    ------------------------------------------------------------------------
    🌟 Please leave a LIKE ❤️ and SUBSCRIBE for more AMAZING content! 🌟
    ✨ Tags ✨
    how to solve Print Anagrams Together
    how to solve 49. Group Anagrams
    question asked in Google
    how to crack online coding test
    how to crack Google Interview
    off-campus placement
    how to learn to code for beginners
    Practice Hashing data structure
    hashing in data structure
    Best Telegram channel for Off-campus Placement drive
    hashing in a data structure in Hindi
    unordered_map
    #hashing #geeksforgeeks #programming

КОМЕНТАРІ • 132

  • @kunnu223
    @kunnu223 Рік тому +8

    this is the only course on youtube which cover whole hashing in very simple way
    thanks for this amazing playlist ❤

  • @palashgupta3607
    @palashgupta3607 8 місяців тому +1

    thank you prince bhai video abhi pura nai dekha pr starting m aap ne voh baat keh dii ki logic dimag m aajata h pr implement nai hota toh yeh bhout hota h mere sth .

  • @shivsagarshah24
    @shivsagarshah24 3 роки тому +4

    This question irritates a lot but now thank you for this solution!!!!

  • @rahulgautam6387
    @rahulgautam6387 2 роки тому

    Your Teaching style is good because you work on real problem like leetcode and gfg problems

  • @vishaljain4642
    @vishaljain4642 3 роки тому +2

    Bhaiyya app ki explanation gazab he🔥🔥🔥🔥🔥

  • @sujeetkumarsharma9538
    @sujeetkumarsharma9538 3 роки тому +1

    Thankfully say to increase my interest in coding skill and understanding of problem...🙏🙏🙏💕💕💕

  • @satyamsourav1488
    @satyamsourav1488 2 роки тому +1

    Am actually following this series since yesterday. Almost done with it.
    Also, I tried solving the problems on my own, first.
    Thanks alot!

    • @PIYUSH-lz1zq
      @PIYUSH-lz1zq 2 роки тому

      bro, vo string ko sort karne ke bat kya equal no of char ke respect me key val store ho raha hai kay ???

    • @vitaminprotein2217
      @vitaminprotein2217 2 роки тому

      @@PIYUSH-lz1zq ha, uss sort string ke andr wli value ke corresponding original string ko map kra rhe,
      also can u tell me why we use x.second insted x->second ?as i didnt understant from the video

    • @HelloWorldbyprince
      @HelloWorldbyprince  Рік тому

      Well done! Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀

  • @niravgusai6718
    @niravgusai6718 3 роки тому +2

    Understandable and quick solution......👌👌

  • @nehatanganiya5491
    @nehatanganiya5491 2 роки тому +1

    thank you so much sir u r real good teacher..u exp very well

    • @HelloWorldbyprince
      @HelloWorldbyprince  2 роки тому +1

      You are most welcome
      Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀

  • @siddharthsingh8010
    @siddharthsingh8010 Рік тому +1

    Hey man can you explain the more optimized approach of this question without sorting

  • @CSe_IT_Guy
    @CSe_IT_Guy 2 роки тому +1

    Bhaiya thankyou finally Hashing ke problem ab solve ho rhe hai🥰

  • @rode_atharva
    @rode_atharva 3 місяці тому

    class Solution {
    public:
    vector groupAnagrams(vector& strs) {
    vector ans;

    map mp;

    for(auto i :strs){
    string key = i;
    sort(key.begin(), key.end());
    mp[key].push_back(i);
    }
    for(auto i :mp){
    ans.push_back(i.second);
    }
    return ans;
    }
    };

  • @oqant0424
    @oqant0424 Рік тому

    U made a tough question ,so easy!

  • @snehamandal5376
    @snehamandal5376 Рік тому

    Amazing sir grate explanation!! but I would like to add one suggestion it would be more efficient if you use (auto &x:strs) as passing by reference wont create copies of the same variables as it might be expensive in case of strings. Keep the good work up sir👍👍👍

  • @sujeetkumarsharma9538
    @sujeetkumarsharma9538 3 роки тому +2

    Great video nice explanation.

  • @chidambarjoshi3470
    @chidambarjoshi3470 3 роки тому +2

    great tutor

  • @SajanKumar-ec2us
    @SajanKumar-ec2us 24 дні тому

    explanation is easy

  • @carnato
    @carnato 3 роки тому +2

    Hello Prince Bhaiya,
    ek help chahiye thi
    subarrray O(n) me solve krna hai.
    But ham isko O(n^3) me hi kr pa rhai hai
    Plz help because I search every where but not find answer

    • @carnato
      @carnato 3 роки тому

      Bhaiya kuch solution batai iska

    • @shivamehta6537
      @shivamehta6537 3 роки тому +1

      Use kadane's algorithms which is used for solving subarray in O(n )time search in UA-cam 😀

    • @carnato
      @carnato 3 роки тому

      @@shivamehta6537 bhai ye sayad sum max ke lia hoti hai may be dekhta hu

    • @HelloWorldbyprince
      @HelloWorldbyprince  3 роки тому

      subarray me kya karna hai ? pahle aap ye clear karo

    • @carnato
      @carnato 3 роки тому

      @@HelloWorldbyprince bhaiya
      generate all possible subarray of given array

  • @pranavsharma7479
    @pranavsharma7479 2 роки тому

    bro tell one thing i used map as unordered_map will not hash vector and map by default, but when i am trying to do find of vector its saying no matching call. whats it
    vector groupAnagrams(vector& strs) {
    map mpp;
    vector ans;
    for(auto s : strs){
    vector count(26,0);
    for(char ch : s){
    count[ch-'a']++;
    }
    }
    if(mpp.find(count) != mpp.end()){
    mpp[count].push_back(s);
    }else{
    mpp[count].push_back(s);
    }
    for(auto it : mpp){
    auto temp = it.second;
    ans.push_back(temp);
    }
    return temp;
    }

  • @377mayureshpitambare6
    @377mayureshpitambare6 2 роки тому +1

    u never disappoint anyone...Gained a like share and a subscriber

  • @s-_-r009
    @s-_-r009 9 місяців тому

    very neat and easy explanation. Thanks sir !

  • @xkall
    @xkall Рік тому +4

    Thanks bro! You solution was very easy to understand and uncomplicated. 🔥

  • @neerajgarg9096
    @neerajgarg9096 2 роки тому

    *One word that comes out from my mouth after watching your video is* -Sekc-

  • @yashparalikar05
    @yashparalikar05 Рік тому

    Perfect Explanation!

  • @Learnprogramming-q7f
    @Learnprogramming-q7f 4 місяці тому

    Thank you bhaiya

  • @sohebshaikh3344
    @sohebshaikh3344 3 роки тому +1

    great explanation prince bhaiya keep it up

  • @akshaypathak7866
    @akshaypathak7866 2 роки тому

    Thanks bhai for easy method

    • @PIYUSH-lz1zq
      @PIYUSH-lz1zq 2 роки тому

      bro, vo string ko sort karne ke bat kya equal no of char ke respect me key val store ho raha hai kay ???

    • @HelloWorldbyprince
      @HelloWorldbyprince  Рік тому

      Any time

  • @akashkhandelwal-altruistic5363
    @akashkhandelwal-altruistic5363 2 роки тому

    Thank you sir for awesome explanation.

  • @devbhattacharya153
    @devbhattacharya153 2 роки тому +1

    Thanks a lot sir!!! :)

  • @joyjain3111
    @joyjain3111 Рік тому +1

    ✨👍🏻

  • @316_mohammadahadkhan7
    @316_mohammadahadkhan7 Рік тому

    when i first saw your video , i am sorry but i thought i should watch some other video as it was very dark themed XD , but bro your explanation is so good that if i see your face in a video i am searching i know you will make me understand that concept top to bottom.

  • @vishaljain4642
    @vishaljain4642 3 роки тому +1

    Bhaiyya graph ke upar videos banao

  • @rahulsinghshekhawat2487
    @rahulsinghshekhawat2487 Рік тому

    great!!

  • @salmaniproductions1104
    @salmaniproductions1104 Рік тому

    DONE! Thank you bhaiiyyaa

  • @himanshubanate9061
    @himanshubanate9061 3 роки тому +1

    great work

    • @HelloWorldbyprince
      @HelloWorldbyprince  3 роки тому +1

      keep learning buddy and be consistent and share my channel with your college groups that helps me a lot

  • @abusayed8153
    @abusayed8153 2 роки тому

    that's good.

  • @youtubeignore3958
    @youtubeignore3958 6 місяців тому

    keep making video bro

  • @oqant0424
    @oqant0424 Рік тому

    16/18 done (11.12.22)

  • @AmitKumar-je9qo
    @AmitKumar-je9qo 3 роки тому

    Bhaiya....Kisi BHI code Ka time and space complexity kaise. Calculate krte hai....ispr video bna dijiye

  • @nischayagrawalVlogs
    @nischayagrawalVlogs Рік тому

    do explain time and space complexities please

    • @_rashmi_kumari_
      @_rashmi_kumari_ 10 місяців тому

      TC: O(1) as unordered map require O(1) for its operation
      SC: O(n^2) b/c of using 2d ans array to store ans

  • @amansayer4943
    @amansayer4943 Рік тому

    i got an intution of taking map and sorting each and every element and comparing it but still i was not confident

  • @rdxgaurav3483
    @rdxgaurav3483 2 роки тому +1

    Khud se aise solve kiya lekin time limit exceed ho gaya 😂😂
    class Solution {

    bool isAnagram(string s, string r){
    sort(s.begin(),s.end());
    sort(r.begin(),r.end());
    if(r==s){
    return true;
    }
    return false;
    }


    public:
    vector groupAnagrams(vector& strs) {
    vector ans;
    vector mark(size,0);
    int size = strs.size();

    for(int i=0;i

  • @yousufahmed985
    @yousufahmed985 8 місяців тому

    lmao dude you made it so easy

  • @sameerswankar
    @sameerswankar Рік тому

    Noice

  • @joyjain3111
    @joyjain3111 Рік тому +1

    Time and space complexity??

  • @amanmotghare7196
    @amanmotghare7196 Рік тому +2

    I have done with logic for earlier question and it was as similar as your logic but the trouble was implementation with code

  • @tyntynstories9331
    @tyntynstories9331 Рік тому

    Thankyou very much

  • @eminence_Shadow
    @eminence_Shadow Рік тому

    Hey Prince 👋

  • @vishaljain4642
    @vishaljain4642 3 роки тому +1

    Graph samz ne me dikkat aa rhi he

  • @zerohell4398
    @zerohell4398 Рік тому

    ya sir ho gaya

  • @nitishtripathi8275
    @nitishtripathi8275 2 роки тому +1

    🤩🤩

    • @PIYUSH-lz1zq
      @PIYUSH-lz1zq 2 роки тому +1

      bro, vo string ko sort karne ke bat kya equal no of char ke respect me key val store ho raha hai kay ???

    • @HelloWorldbyprince
      @HelloWorldbyprince  Рік тому +1

      🔥

  • @yogeshsikanderpuriya7417
    @yogeshsikanderpuriya7417 3 роки тому +2

    please make a series on dynamic programming

  • @VivekKumar-ui1ro
    @VivekKumar-ui1ro Рік тому +1

    Coding made easy from the moment I got to know about this channel

    • @HelloWorldbyprince
      @HelloWorldbyprince  Рік тому +1

      Hahah Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀

  • @saurabhkunwar3692
    @saurabhkunwar3692 Рік тому

    your explantion is amazing

    • @HelloWorldbyprince
      @HelloWorldbyprince  11 місяців тому +1

      Thanks
      Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀

  • @yogeshsikanderpuriya7417
    @yogeshsikanderpuriya7417 3 роки тому +1

    only video with 0 dislikes ...great going bhaiya

  • @tarunchauhan1025
    @tarunchauhan1025 2 роки тому +1

    Very good problem and well explained!!
    Thanks bhaiya!!!!!

    • @HelloWorldbyprince
      @HelloWorldbyprince  2 роки тому +1

      Thanks bhai
      Bass share kardo channel ko mere motivation ke liye

    • @tarunchauhan1025
      @tarunchauhan1025 2 роки тому

      @@HelloWorldbyprince I shared ur video with my frnds

  • @ExpoDev_Dash
    @ExpoDev_Dash 10 місяців тому

    Sir ab aap popular ho

  • @mayurkhodre1404
    @mayurkhodre1404 2 роки тому +1

    Nice explanation...keep it up😊

    • @HelloWorldbyprince
      @HelloWorldbyprince  2 роки тому +1

      Thanks a ton
      Please, if possible then share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀

  • @yogeshsikanderpuriya7417
    @yogeshsikanderpuriya7417 3 роки тому +1

    man ur explaination is the best

  • @vikasrajput7718
    @vikasrajput7718 5 місяців тому

    Easy explanation
    Keep it up!!

  • @sakshisahu3983
    @sakshisahu3983 2 роки тому +1

    Just wanna thank you for explaining so well.

  • @ogbuddha7835
    @ogbuddha7835 2 роки тому

    🙈

  • @masumali8356
    @masumali8356 Рік тому

    you are the best........masum.

  • @anonymous090
    @anonymous090 2 роки тому

    Homework completed!! 🕑

  • @amanahmed6057
    @amanahmed6057 3 роки тому

    bhai linked list par bhi banaao yaar

  • @SumitKumar-tj8fp
    @SumitKumar-tj8fp 3 роки тому

    please increase Font Size of code section.

  • @HarshitSharma-ie8li
    @HarshitSharma-ie8li Рік тому

    Sir the solution is way too good but I think we should sort temp and insert x , because we should not change the given data set.

    • @sameerswankar
      @sameerswankar Рік тому

      we are not changing given data set , when u do auto x:strs, copy of every element of strs will get stored in x for each iteration... its not the original element , its the copy.

  • @abhishekrai3
    @abhishekrai3 Рік тому

    Hat's off bhaiya, really apke explain krne ka trika amazing hai, aap aisa padhate hai ki concept chhap jata hai dimak me. Thanks alot bhaiya for such a amzing playlist.

  • @rahulmandal3018
    @rahulmandal3018 10 місяців тому

    Really liked the explanation + code ❤

  • @adityagulhane7271
    @adityagulhane7271 2 роки тому

    Bohot sahi bhiya....Aap actully man ki baat jaan lete hai😃

    • @HelloWorldbyprince
      @HelloWorldbyprince  2 роки тому

      Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀

  • @aman7703
    @aman7703 2 роки тому

    Great video series 👍 👏 👌

  • @abhaygoyal594
    @abhaygoyal594 2 місяці тому

    Great solution man