Prefix Sum + Hashing HARD Question | Competitive Programming Course | EP 16

Поділитися
Вставка
  • Опубліковано 10 січ 2025

КОМЕНТАРІ • 184

  • @manthanvats9809
    @manthanvats9809 3 роки тому +81

    today after learning from YOUR STL series I tried to solve this questions using MAP and I was able to solve this question with help of maps and hashing even in lesser time...YOUR SOLUTION took on Average of more than 1 seconds but with help of MAP it took less than 0.5 on every test case...YOU ARE LIKE A BOON FOR ME...THANKS BROTHER..

    • @komaldeepsingh6356
      @komaldeepsingh6356 3 роки тому +7

      can you please share the code so that we can also have an idea how to solve this using map?

    • @__RohitDevar
      @__RohitDevar 3 роки тому +8

      @@komaldeepsingh6356 hey i too solved it using maps ...
      #include
      using namespace std;
      int main()
      {
      int T;
      cin >> T;
      while(T--)
      {
      int n,q;
      cin >> n >> q;
      string s ;
      cin >> s;
      unordered_map < char ,vector< int >> m;
      for(int i=0;i

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

      @@__RohitDevar thnx brdr😃

  • @abhaytiwari6411
    @abhaytiwari6411 3 роки тому +28

    Your Teaching Style is Literally Awesome

  • @ashwinsingh1731
    @ashwinsingh1731 3 роки тому +26

    This concept helped me solving 5th question of codechef div 3 . Bahut bahut dhanyawaad bhaiya❤️

  • @jhashivam28
    @jhashivam28 3 роки тому +14

    Itne details mn to koi chah k bhi nhi bna payega yh course 🔥💪

  • @mananjain1184
    @mananjain1184 3 роки тому +74

    hey, did you learnt all these optimization approaches by hit n trial?
    if not can you share the resources by which we can learn these optimizations?
    btw very nice content, keep it up.

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

      he had replied to some faltu comments asking his fav anime but not this one. clearly he dont want us to know all things. clearly shows his mentality

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

      abe chutiyo editorial name ki cheese b hoti hai .....gadho

    • @shishirsaraf8498
      @shishirsaraf8498 11 місяців тому +3

      Your this mentality is completely wrong, he's an alumni of IIIT Allahabad, how will he be able to explain how he learnt these techniques, this is completely unacceptable comment
      @@kartikforwork

    • @kartikforwork
      @kartikforwork 11 місяців тому

      where did iita dome bw? can you explain ur point more accurately. its a normal think to ask people how they learn it. why can't he explain it?@@shishirsaraf8498

  • @ANUJKUMAR-fu4bk
    @ANUJKUMAR-fu4bk 3 роки тому +5

    We can be do in this way "Pre-calculate the How many letters have odd count from 0 to i. And after apply prefix sum can be found no. of odd count letter.(b/w L-R). if(no

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

      I thought the same after 2 years

  • @ashishbhardwaj6696
    @ashishbhardwaj6696 3 роки тому +6

    Bro this playlist is just awesome please do complete it am gonna watch it till the end!!!.

  • @l1f3l3s2
    @l1f3l3s2 4 місяці тому +2

    it would be less confusing if the array was declared arr[26][N] like you discussed!
    Btw great playlist. Hoping to finish it soon and be better at CP. :)

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

    Bhaiya ,mene kai saare articles/videos dekhi, but aap jesa STL kisi ne nai samjhaaya, aapka videos superrllyyyy best and unique hai bilkul, and mein ye sach me keh raha kyuki me jaanta hu mein kitna pareshan tha apne doubts ko le kar, merey saare doubts aapne clear kar li hai,,,Vesey aap aur jaada likes and subscribers deserve kartey ho🙏🏻🙏🏻🙏🏻

  • @AgnivaBanerjee6
    @AgnivaBanerjee6 3 роки тому +11

    Thank you , sir.
    Here is the code if anyone needs it.
    #include
    using namespace std;
    const int N=1e5+10;
    int hsh[N][26];
    int main()
    {
    int t;int n; int q; cin>>t ;
    while(t--)
    {
    cin>>n ;cin>>q ;
    for (int i=0;is ;
    for (int i=0;i>r ; int oddcount=0; //The concept is that if oddcount

  • @amimultamim9893
    @amimultamim9893 4 місяці тому +1

    Awesome problem with awesome technique. Thanks a lot.

  • @-RohitJaiswal
    @-RohitJaiswal 3 роки тому +8

    INT_MAX number of thankyous is also not enough for this course. Thanks a lot sirrrr...

  • @mugiwara5010
    @mugiwara5010 2 роки тому +10

    one piece fans smiling while solving the question

  • @stevefox2318
    @stevefox2318 3 роки тому +5

    Pre computation is best thanks for teaching us

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

    Awesome Explanation

  • @uvsingh
    @uvsingh 3 роки тому +8

    Luv sir, URL not found of the given problem, although this video is more than enough to solve this question...Thank-you very much

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

    5:11 you can insert those 3 cs in the middle to make it palindrome right?

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

      No bro bcz if we insert 3 cs after adding d in pallindrome it won't match the requirements =aabdcccbaa bcz of d its not possible. I hope this helps :)

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

    DUDE THIS WAS " A W E S O M E "

  • @anmolpreetsingh8175
    @anmolpreetsingh8175 3 роки тому +10

    I am watching this video on a very special occasion i.e. 1000th episode of ONE PIECE is released :)

  • @abc-ym4zs
    @abc-ym4zs 2 роки тому +2

    i am really feeling very hard to learn those optimization techniques sir

  • @shishirsaraf8498
    @shishirsaraf8498 11 місяців тому

    Bhaiyaa, I literally love this playlist, but I request you to please, please continue this playlist again

  • @SATISHKUMAR-bj2kl
    @SATISHKUMAR-bj2kl 3 роки тому +7

    nay nay LUV-San
    finally some question which make me more exited then rest bcoz of One Piece Dressrosa Arc
    I am watching atleast one video of yours everyday.
    Arigato Gozaimus.
    If you are reading this comment then plzz mention your fav. Arc

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

    Great Video Series bro, Keep going on.

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

    can you update the link of the question pls.

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

    Amazing technique🔥🔥🔥

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

    Bahut bahut dhanyawaad bhaiya❤️

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

    Awesome concepts 🔥

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

    thnks a lot ......plz upload more videos waiting........

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

    i love that u are an one piece fan just like meee

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

    If odd_count == 1 or 0 then it will print "YES" but how it is justified for the EVEN length sub-string to have odd_count == 1 ? If odd_count == 1 for an even length substring from L to R ..... it wont form palindrome.

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

      For even length of substring, odd_count will have to become 0 for returning YES

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

      @@badvelisridhar indeed

  • @kunalsingh6961
    @kunalsingh6961 2 роки тому +9

    Sir, question url is invalid .
    Kindly fix it .
    Btw awesome explanation 🙌

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

    What if we use map of char and int...

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

      you can use but maps will have logn complexity, you can use unordered maps also which are o(1)

  • @showaibnowfel2816
    @showaibnowfel2816 5 місяців тому +1

    Who had come here to see this video after codeforce round 962 div3 problem C ?

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

    Well explained!

  • @TusharSingh-un9wn
    @TusharSingh-un9wn 3 роки тому +5

    Can we use int hsh[26] ={0}, instead of a loop assigning each index 0.

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

    Great Video !!

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

    sir practice question link is not working

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

    why hsh[n][26] ? not hsh[26][n] ==> 26 array with n items..???

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

      you can use any just with slight change in code. its very similar. how i think is int a[n] is one array, so int a[n][26] are 26 arrays it just an imagination pov

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

      @@iamluv thanks for replying 😊

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

    The code from my side :
    #include
    using namespace std;
    int main()
    {
    string x;
    coutx;
    int size = sizeof(x) / sizeof(x[0]);
    int res[size];
    int n = 0;
    int st = 0;
    while(x[n] != '\0')
    {
    // res[n] = x[n];
    for(int i = 0; x[i] != '\0'; i++)
    {
    if(x[n]==x[i])
    {
    st+=1;
    }
    }
    res[n] = st;
    st = 0;
    n++;
    }
    n = 0;
    for(int i = 0; x[i] != '\0'; i++)
    {
    if(res[i]==1)
    {
    n+=1;
    }
    }
    if(n>1)
    {
    cout

  • @subhasispanda4960
    @subhasispanda4960 3 роки тому +6

    According to your explanation ie. for each letter one 'n' sized array, the hsh array should be hsh[26][N].
    means, 26 rows and N columns and accordingly there'll be few changes(swaps) in the code. But anyways your code is working fine.
    Please correct me anyone, if I am wrong.
    and Thanks luv bhai.. for these explanations... for your dedicated teaching...
    I am sure, I'll be a good coder one day thanks to you.❤❤

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

      its just a matter of imagination i imagine, int hash[N] array of N integers and adding 26 once more to infront makes 26 arrays of those, what you are thinking is also correct only.

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

      @@iamluvso..a matter of convention ! Anyways, you have already made my 2d array concept crystal clear. So thanks for giving me the opportunity to again analyse n-D array in a meaningful way. 🙏🏻🙏🏻❤️

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

      same i was thinking like u subhasis.. but both r same, and i felt little complex what he(luv) is doing..

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

      @@iamluv yes got it..

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

      I was stuck there thinking just this thing and did not even complete the video. Was looking for someone to put this into comments.

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

    Great video bhaiya

  • @Xp-Sam
    @Xp-Sam 3 роки тому +5

    bhaiyya [26][N] ka example deke jab [N] [26] ka code likh diye to dimaag ghumne laga😅

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

      N size ke 26 arrays banane ke liye bola example me bhi which means [N][26] only 😅, dono shi hi hai bas ye thoda sochne me idhar udhar hi jata hai...

    • @Xp-Sam
      @Xp-Sam 3 роки тому +3

      Bhaiyya 13:30 pe dekho... aapne bola N size ke 26 arrays matlab [26][N] hua na? aur image me bhi waise hi hai..

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

      @@Xp-Sam haan even i felt it should be [26][N] , confuse hogaya mai

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

      N size ke 26 arrays means [N][26] , int a[n] is one array if want to make 5 such array then its like int a[n][5], putting bracket in front of anything make it an array. so existing int a[N] and then 26 arrays of that int a[N][26], but i get it why you are confused, but as i said its same thing only..

    • @Xp-Sam
      @Xp-Sam 3 роки тому

      @@iamluv Yes... you are right bhaiyya,actually ham log ko aadat ho gaya row wise dekhne ka for eg. hamare liye visually arr[1][2] ek single array jaisa hai like arr[2].
      but aap wale perception se pehla wala 2 array hai of single blocks

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

    bai discord nhi join horha tumhara invitation invalid arha ha

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

    #include
    using namespace std;
    int main()
    {
    // string str = "abcec";
    // vector queries = {{1, 2}, {2, 5}, {3, 5}, {1, 5}, {1, 4}, {5, 5}};
    string str = "aabbc";
    vector queries = {{1, 2}, {2, 5}, {3, 5}, {1, 5}, {1, 4}};
    int n = str.size();
    vector res;
    vector mp(26, vector(n, 0));
    for (int i = 0; i < n; i++)
    {
    char ch = str[i];
    mp[ch - 'a'][i]++;
    }
    for (int i = 0; i < 26; i++)
    {
    for (int j = 1; j < n; j++)
    {
    mp[i][j] += mp[i][j - 1];
    }
    }
    for (int i = 0; i < queries.size(); i++)
    {
    int l = queries[i][0];
    int r = queries[i][1];
    l--, r--;
    int numberofodd = 0;
    for (int i = 0; i < 26; i++)
    {
    vector prefix = mp[i];
    int count = prefix[r];
    if (l - 1 >= 0)
    count -= prefix[l - 1];
    if (count % 2 == 1)
    {
    numberofodd++;
    }
    }
    if (numberofodd

  • @mr.curious1329
    @mr.curious1329 3 роки тому

    Beautiful ques 👍👍

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

    why does the link to given question shows error 404! I can't find the question!

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

    what if i got a substring "abb" for a given range... which is not palindrome. but in your case, it shows a valid one... am i missing something or solving palindrome problem counting their occurrence is wrong approach?

    • @mr.t3141
      @mr.t3141 7 місяців тому +1

      we reorder the obtained substring

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

    While finding the Oddcount, we started from 0 till 25th index, but we could have used from l till r, right?

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

      0 to 25 is to get count of each letter(from a to z) between l to r. You are confusing the twi things. L to R is for array index. 0 to 25 is for a to z letters

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

    bro ur ques link is not opening

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

    i was way tooo close to the solution. Only did a minute mistake. Next time I WILL SOLVE these type of question

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

    The link to the problem is not working, can anyone give the updated link?

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

    Hello bro,please make cp questions list . Which help to understand all dsa topic

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

    Warning: do not use the name 'hash' as your hash array.

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

      i used hsh and not hash, you should not use hash as hash is a reserved keyword in c/c++

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

      @@iamluv Haan bhaiya stackoverflow helped me. I was re-attempting the question and wasted so much time on debugging.

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

    "[Finished in 56.8s]" lmfao

    • @iamluv
      @iamluv  3 роки тому +6

      yeah, my laptop has too much going on while recording :'( its getting from cmaers,recording its on screen and then recording ipad screen also, so it gets very slow.

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

      @@iamluv bhaiya how to understand a given question can be solved in particular data structure and Algorithm eg: for sorted array only we can apply binary search tree

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

    videos me jo question aapne kraya wo to samajh aa gya aur ban ja raha hai but jb mai hashing topic ka ya prefix sum ka question kisi website pe open kr raha hu to ni ban rha hai hai kya kru?????

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

    for the 2nd testcase [1,2]="aa" is palindrome ,but you have given NO as answer

  • @eqzist7599
    @eqzist7599 День тому

    Right now, i am watching the same episode of One piece

  • @devenderkumar-pr6ig
    @devenderkumar-pr6ig 3 роки тому +3

    awesome

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

    Finger at 4:49

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

    bhaiya competetive programming start krne ke liye pura course complete krna pdega yaa abhi mai contest de skta hu!

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

    bro i tried to visit the question but it says that invalid url

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

    Luv bhaiya orz 🔥

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

    Can someone tell me the problem name as the link is not working for me

  • @GANESHSINGH-oe2wy
    @GANESHSINGH-oe2wy 3 роки тому

    🙏🏻 🙏🏻Sir, aap padhate waqt highlight krne ke liye konsa softwate use krte ho (jo laser jaisa dikhta hai phir apne aap gayab ho jata hai) 🙏🏻🙏🏻

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

      vo ipad ka software h inbuild

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

    link for that problem is not working

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

    Bro I m 2nd year student and I spent lot of time doing web dev works .now I m kind of going to start competitive programming am I late 😭.

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

      no, just follow the course and practice a lot, you will be able to do it.

    • @ShubhamVerma-hw4uj
      @ShubhamVerma-hw4uj 3 роки тому +1

      Which sem bro?

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

      @@ShubhamVerma-hw4uj bro are you from lko?

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

    Best❤️❤️❤️

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

    problem link is not working. please give me the link

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

    now the problem ain't available anymore

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

    ye hard ques to kuch jada he complex hai. 26 array banane the but phir aapne khidi paka di

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

    Linl of the question is not working

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

    question link is invalid now :/

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

    Bhaiya your questions link is not working

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

    bhaiya aapne one piece dekhi h?

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

      haa

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

      @@iamluv favorite anime bhaiya aapka?

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

      @@iamluv bhaiya whitebeard ko weak dikhaya tha na marineford m ???kya vichar h bhaiya

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

      Bhaiya , Goku > Saitama na?

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

      @@siddharthadeo9944 obviously bhai..... Ye bhi koi puchne wala question h😔

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

    @Luv aababaa here a is coming 5 times but it is a plidrm please help

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

    6:38

  • @VarunGoud-y6x
    @VarunGoud-y6x Рік тому

    op supermacy🤩

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

    please look into it .. the problem link given in description is not working

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

      yes its not working for me also, its some hackerearth server issue, not sure what can be done here.

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

    spoiler de diye bhai one piece ka😭😭😭😭😭

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

    bhayia problem link is not working ....khulne pr blank screen aa rhi hai .....tried on mobile too

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

      Which link?

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

      @@iamluv link to the problem you have discussed in this video

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

      @@iamluv please look into it .. the problem link given is not working

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

      yeah its not working for me also, its some hackerearth issue link is correct but its not working, not sure why

  • @30harshkumawat31
    @30harshkumawat31 3 роки тому

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

    Anyone please tell me what is the difference between test cases (t) and queries (q) ??

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

      for 1 test case there is q more testcase u can understand bt this
      for each test case new string will be entered but in querey test case will be on same string

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

      they are basically treated same

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

    bhai agar source code provide kara dete to bahut help ho jati, btw thanks

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

    bro problem link not working

  • @AryanRaj-yj4ji
    @AryanRaj-yj4ji 3 роки тому

    question link

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

    thank you

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

    ur explanantion is awesome bro. try making courses at udemy and other platforms.it would make you a fortune

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

    Attendance 16

  • @30harshkumawat31
    @30harshkumawat31 3 роки тому

    error a rhi he sir

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

    Thank you bhaiya 🙇🏻

  • @Sarkar.editsz
    @Sarkar.editsz 2 роки тому

    Hands down

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

    2 yellow heart

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

    bro link to this question is not working :(

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

      I know, its a hackerearth issue :(

  • @TusharSingh-un9wn
    @TusharSingh-un9wn 3 роки тому

    OP fan, I see.🌚

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

    Question's link isn't active......

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

      yes, its hackerearth issue, you can find similar questions in the contest of precomputation

  • @piytube1
    @piytube1 7 місяців тому

    Nice

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

    Bhaiya when is binary search coming?

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

    anime and coding

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

    #include
    using namespace std;
    const int N = 1e7 + 10;
    int hsh[N][26];
    int main()
    {
    int t;
    cin >> t;
    while (t--)
    {
    for (int i = 0; i < N; i++)
    {
    for (int j = 0; j < 26; j++)
    {
    hsh[i][j] = 0;
    }
    }
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    for (int i = 0; i l >> r;
    int oddcnt = 0;
    for (int i = 0; i < 26; i++)
    {
    int charCt = hsh[r][i] - hsh[l - 1][i];
    if (charCt % 2 != 0)
    {
    oddcnt++;
    }
    }
    if (oddcnt > 1)
    {
    cout

  • @MukeshSaini-vo1bq
    @MukeshSaini-vo1bq 2 роки тому

    Just a comment to increase reach