Find All Anagrams in a String | Leetcode 438 | Array

Поділитися
Вставка
  • Опубліковано 19 жов 2024
  • Time Complexity : O(n*26) ~ O(n)
    Space Complexity : O(1)
    Problem Link : leetcode.com/p...
    C++ Code Link : github.com/Ayu...
    Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)
    #DataStructuresAndAlgorithms
    #LoveBabbarDSASheet
    #interviewpreparation
    Find All Anagrams in a String solution
    Find All Anagrams in a String Leetcode
    Find All Anagrams in a String C++
    Find All Anagrams in a String Java
    Find All Anagrams in a String Python
    🔥🔥🔥🔥👇👇👇
    Join telegram channel for more updates on placement preparation : t.me/AyushiSha...
    Checkout the series: 🔥🔥🔥
    👉Interview Experiences : • Interview Experiences
    👉 Array: • Arrays
    👉 Linked List : • Linked List
    👉 Heap : • Heap
    👉 Recursion : • Recursion
    👉 Stack and Queue : • Stack And Queue
    👉 Greedy : • Greedy
    👉 Dynamic Programming : • Dynamic Programming
    👉 Leetcode contests : • Leetcode contests
    👉 Leetcode June Challenge : • Leetcode June Challenge
    👉 Leetcode July Challenge : • Leetcode July Challenge
    LIKE | SHARE | SUBSCRIBE 🔥🔥😊

КОМЕНТАРІ • 54

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

    Great Explanation 💯🔥
    Earlier I thought of finding permutations of p's and storing in hashmap and then just iterating over the anagram string..

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

      Here will the Space complexity be O(1) !!
      I meant we are using an answer vector na so that way ...?
      Those two freq and window vector have constant space but the ans vector!!

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

      yes, but the output vector or string we have, that we do not consider as extra space :), because that is anyway needed, any extra data structure we use for solution, that we consider in space complexity :)

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

      @@AyushiSharmaDSA ohh yaa

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

    Awesome, very clear explanation with examples..

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

    Thanks for that awesome explaination!! 🤗

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

    I liked your consistency Sis 👏. Started doing daily Leetcode challenge problem bcoz of u. You are truly an inspiration to me...😊

  • @RajeshS-n2j
    @RajeshS-n2j 18 днів тому

    another elegant solution, nice as always. 😀

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

    Great explaination di. Got the approach

  • @s.vibhor
    @s.vibhor 2 роки тому

    Solution was great
    Subscribed 💯

  • @Leetcore-2508
    @Leetcore-2508 2 роки тому

    Explanation was just perfect...!!!👍

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

    you are gem i don;t have words to thank you

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

    Playlist me apne sare videos dalo topic wise bohot help hogi

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

    Thank you di

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

    if u r comparing vectors in each step its complexity would be o(k) so overall complexity will be o(n*k).also the space complexity is not constant its o(n).because u r using the extra array

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

      Hi , size of vector is 26 and space complexity will be constant as vector size will be 26

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

      @@AyushiSharmaDSA u r right size is small so it wont matter here

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

    superb explanation 🙌🙌🥳🥳di can u plz make a video on sum of two arrays

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

    OP Solution

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

    Which colllage
    ?

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

    Please solve Set Matrix Zeroes leetcode problem

  • @VishnuYadav-so5yv
    @VishnuYadav-so5yv 2 роки тому

    How many questions to do per topic??

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

      Hi Vishnu, nothing as such, just start with easy practice around(10-15) and then you can do medium problems.

    • @VishnuYadav-so5yv
      @VishnuYadav-so5yv 2 роки тому +1

      @@AyushiSharmaDSA as a beginner, can I start watching your arrays vedio

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

      @@VishnuYadav-so5yv no, I would suggest first get familiar with every data structure like if you want to use hashmap then which library you will use, like that. Then when you know each and every data structure, you can start practicing different problems :)

    • @VishnuYadav-so5yv
      @VishnuYadav-so5yv 2 роки тому +1

      @@AyushiSharmaDSA okk thank you so much for replying😊

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

    Live class kab se start hogi?

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

      Hi Reena, I actually was thinking that I'll make videos and then we can have live doubt sessions

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

      @@AyushiSharmaDSA Okk 👍

  • @vamsikrishna-nx1gu
    @vamsikrishna-nx1gu 2 роки тому

    I need it in java

  • @NitinSingh-wp5lj
    @NitinSingh-wp5lj 2 роки тому

    🙃java sometimes

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

    Last line not cleared
    i -len+1

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

      Dry run the code bro ,you will get it...
      Since you have to return the starting index that's why we are substracting the Length bcz in loop we are iterating after the window size

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

      Yes Pratyush, dry run once and let me know if it's not clear then :)

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

    can any please check my code it giving 0 as answer always
    int search(string pat, string txt) {
    int p[26]={0};int t[26]={0};
    const char *s = pat.c_str(); int len=0;
    while (*s)
    {
    p[*s-'a']++;
    s++; len++;
    }
    int count=0; int flag=1;
    const char *x = txt.c_str(); int lent=0; const char *first = txt.c_str();
    while(*x)
    {
    t[*x-'a']++;

    if(lent>=len) { flag=1;
    for(int row=0;row

  • @SandeepSharma-xr6ce
    @SandeepSharma-xr6ce 2 роки тому

    New photo mast ha 😄