Permutation in String | Leetcode 567 | Sliding window | Day 11

preview_player
Показать описание
Timestamps:
Problem explanation : 00:00
Approaching the problem : 02:22
Dry Run : 09:23
Code Explanation : 18:25
Complexity analysis : 21:30

Time Complexity : O(n)
Space Complexity : O(26)


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
Permutation in String solution
Permutation in String Leetcode
Permutation in String C++
Permutation in String Java
Permutation in String Python

🔥🔥🔥🔥👇👇👇

Checkout the series: 🔥🔥🔥
LIKE | SHARE | SUBSCRIBE 🔥🔥😊
Рекомендации по теме
Комментарии
Автор

Your video acts as a reminder to solve leetcode daily challenge. Thank you! 💙

durgesh
Автор

You are doing great job!
Happy women's day 😊

mansigoyal
Автор

First time i solved Leetcode daily problem within few minutes, because I saw your all anagrams of string video, and used the same approach in today's problem ✌️😊
Thanks for explanation
Helpful

rajdave
Автор

Very amazing video, nicely explained !

motivationalduniya
Автор

even I know how to solve the problem I am watching your videos because the way you are approaching the problem is very intresting

devendratumu
Автор

Di I have a doubt... What does that m[s2.at(j++) - 'a']-- mean?

deeptimayeemaharana
Автор

I have a doubt here when in line 11, when j- i == s1.size and m[char] is going to be increase because for all the char as we have store 0, so let say if at i we have 'e' than m['e'] >= 0 to hoga hi ... than total_chars++ increase ho jayega

manishv.
Автор

Nice approach once again, I have used a map to store the characters and count represents the unique character, but also i liked your approach of storing in a array, can u tell me which approach is better, i think both is O(n) space as well as time wise ;-
class Solution {
public:
bool checkInclusion(string s1, string s2) {
int n=s1.size(), m=s2.size();if(m<n) return false;
unordered_map<char, int>m1;
for(int i=0;i<n;i++)
{
m1[s1[i]]++;
}
int count=m1.size();
int i=0, j=0;
while(j<m)
{
if(m1.find(s2[j])!=m1.end())
{
m1[s2[j]]--;
if(m1[s2[j]]==0) count--;
}
if(j-i+1<n) j++;
else if((j-i+1)==n)
{
if(count==0) return true;
else
{
if(m1.find(s2[i])!=m1.end())
{
m1[s2[i]]++;
if(m1[s2[i]]==1) count++;
}
i++;
j++;
}
}
}
return false;
}
};

amanbhadani
Автор

ayushi aapki naek video hai ..permutation of a string..usme us code ki complexity n^k hai ..i still didn't get this .can you please make video on that ? or suggest me some resource to get that ..i am actually not getting that ..according to me complexity should be n^n

ispiDeyOP
Автор

padhaane wala aisa ho to topper bnne se koi nhi rok skta mujhe :))

adityakaushik
Автор

Hi mam Can you please solve leetcode problem 373 Find k pairs with smallest sums

viviansharma
Автор

If you explain in hindi, the video would have double reach

simpy