Custom Sort String | Hashing Playlist C++ | Leetcode DSA series | Hindi | Complete DSA course

Поділитися
Вставка
  • Опубліковано 27 вер 2024
  • This is the video under the series of DATA STRUCTURE & ALGORITHM in a HASHING Playlist. We are going to solve the problem "Custom Sort String" from Leetcode which is solved by using a map in c++.
    Join My Telegram channel for more Updates: telegram.me/he...
    order and str are strings composed of lowercase letters. In order, no letter occurs more than once.
    order was sorted in some custom order previously. We want to permute the characters of str so that they match the order that order was sorted. More specifically, if x occurs before y in order, then x should occur before y in the returned string.
    Return any permutation of str (as a string) that satisfies this property.
    Input:
    order = "cba"
    str = "abcd"
    Output: "cbad"
    Explanation: "a", "b", "c" appear in order, so the order of "a", "b", "c" should be "c", "b", and "a".
    Since "d" does not appear in order, it can be at any position in the returned string. "dcba", "cdba", "cbda" are also valid outputs.
    ----------------------------------------------------------------------------------------
    Custom Sort String: leetcode.com/p...
    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 Custom Sort String
    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

КОМЕНТАРІ • 62

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

    hashing done .

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

    nice playlist

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

    Thank you for your guidance

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

    good

  • @realAB459
    @realAB459 2 роки тому +2

    Entire playlist was amazing. Please continue making such kind of videos.

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

      Thanks bhai
      please keep sharing my videos or channel in your colleges or groups please

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

    Please start Dynamic programming playlist

  • @mrssp-go2sc
    @mrssp-go2sc 2 роки тому +2

    Bhai hashing ki puri playlist dekhne k bad I feel like jukega nhi sala❤️👍🙏

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

      Yeahhhh 🔥 🤩👍👍👍🙂
      Main v nahi jukega ab to

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

    1 hi doubt hai meraa baar baar apan log
    string s(count,x)
    kyu banaa rahe hai ??????????

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

      Kyuki humlog ke pass aisa v case ho sakta hai ki, number of characters repeat hote hai
      Please I will recommend u, watch this video again and solve some test case by your own do dry run 🙏

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

    18/18 done (11.12.22)

  • @shubhamkhare26
    @shubhamkhare26 3 роки тому +3

    Keep making video... 💯🔥

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

    best playlist for hash concepts

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

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

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

    there is any playlist of bit manipulation ??

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

    mja aagya
    bas graph me bhi mujhe aise smj aa jaye toh mauz hai

  • @Aks-47
    @Aks-47 3 роки тому +1

    most waiting for LOTS OF TREE VIDEOS

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

    Completed brother I'm from Bhurkunda 🤣

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

    Bhahiya ismay unordered_map use kar sakte hai ky hum?

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

      Karke dekho and please send me solution also
      Isse bhut aacha lagegaa aapko v and humko v

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

      @@HelloWorldbyprince class Solution {
      public:
      string customSortString(string order, string s) {
      unordered_map umap;

      for(auto x:s)
      {
      umap[x]++;
      }
      int i,j=0;
      string ans;
      for(i=0;i!=order.size();i++)
      {
      char ch=order[i];
      auto temp=umap.find(ch);
      if(temp!=umap.end())
      {
      for(j=0;j!=temp->second;j++)
      {
      ans.push_back(temp->first);
      }

      }
      umap.erase(ch);
      }
      for(auto x:umap)
      {
      int c2=x.second;
      for(int c=0;c

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

    I have done this at the time of homework

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

    wwwwwwwwwwwwwooooooooho
    finally completed the whole hashing series
    learnt a hell lot from u
    literally thanks bhaiya from the bottom of my heart

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

    thanks bhai...❤❤❤❤❤

  • @NavdeepSingh-qn1is
    @NavdeepSingh-qn1is 2 роки тому +1

    Good work bhaiya keep it up, please make videos on must-do-questions before interview

  • @Noone-kl6sc
    @Noone-kl6sc 2 роки тому

    Completed 👌💯

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

    Na Na .....pehle waali setup achhi thi

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

      Are bhai, bahut mehant hai ussme, but ab tree most probably pen paper pe padhayenge

  • @pritishpattnaik4674
    @pritishpattnaik4674 2 роки тому +2

    My Approach
    string customSortString(string order, string str) {
    map mp;
    string ans = "";
    for (auto x : str){
    mp[x]++;
    }
    for (int i=0 ; ifirst;
    int val = it->second;
    while (val != 0){
    ans.push_back(x);
    val--;
    }
    }
    return ans;
    }

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

    without much stl:
    mapmp;
    string temp="";
    for(auto x:s)mp[x]++;
    for(auto x:order){
    if(mp.find(x)!=mp.end()){
    // order.append(x.second,x.first)
    //keep adding till all its freq not bcme 0
    while(mp[x]--)temp+=x;//we can add a char in a string (continuation)like this
    mp.erase(x);
    }
    }
    //now add rest of the elements from the map into temp;
    for(auto x:mp){
    while(x.second--)temp+=x.first;
    }
    return temp;

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

    Thank you soo much bhaiya

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

    6:03

  • @harshitgarg5785
    @harshitgarg5785 3 роки тому +3

    Yay! Completed hashing series in just 2 days!!! Thanks bde bhai :)

  • @GudduKumar-fn8tb
    @GudduKumar-fn8tb Рік тому +1

    today i have completed your hashing playlist and thanks alot ,i am always afraid about hashing but you make it crystal clear and easy to learn .

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

    Waiting for tree playlist😊

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

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

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

    bhai, ye jo function s hai, wo built in function hai ki kahi declare kiya hai?

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

    Thank you so much

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

    Nice explanation!

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

    Thank you Bhaiya

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

    Great video!!