Better than Neetcode's explanation on the same problem, and more simple/ straightforward too! Came here cuz the neetcode one was too confusing and long
After watching 3 other videos, this is the clearest of them all, finally understood this problem. Fantastic explanations, pls don't stop making leetcode videos.
just wow.. what a clear and amazing explanation. i was scared of this problem even after looking at various solutions.. your video made it just very simple.. thanks..
Could someone please explain to me why this is faster than the solution I wrote? def check_inclusion(s1: str, s2: str) -> bool: n1, n2 = len(s1), len(s2) if n1 > n2: return False permutations = Counter(s1) for i in range(n2): if permutations == Counter(s2[i:i + n1]): return True return False
below is my solution with hasmaps ,can someone please help me the time complexity of my solution i am new to this concept , thanks in advance. def string_perms(s1,s2): if len(s2) < len(s1): return False d1={} for i in s1: d1[i] = d1.get(i,0) + 1 l=0 r=len(s1) while r
Master Data Structures & Algorithms For FREE at AlgoMap.io!
This is a more clear explanation than Neetcode. Solidified the concept right away. Thanks!
The code is still written like crap
way simpler than whole Leet code discussion forum and editorial, you have my respect sir !
Better than Neetcode's explanation on the same problem, and more simple/ straightforward too! Came here cuz the neetcode one was too confusing and long
OMG! This is the clearest explanation I have seen! Really hope you keep making videos!
Really glad to hear that
After watching 3 other videos, this is the clearest of them all, finally understood this problem. Fantastic explanations, pls don't stop making leetcode videos.
Wow. This is better explanation I came across.
Another video you explained better than anyone else! Thanks greg!
just wow.. what a clear and amazing explanation. i was scared of this problem even after looking at various solutions.. your video made it just very simple.. thanks..
Very clear and detailed line by line explanation which helped me to understand the algorithm better. Thank you for your efforts !!!!
The best explanation I have come across for this problem! thank you so much
The count array gets rid of the permutation problem and the sliding window trick gives a nicely scalable iteration. Edit: watched to the end... Nice
This is an epic explanation! Thank you!
Glad to hear it, thanks a ton!!
Thank you so much for making this video! It is crystal clear!
Simple and elegant, thank you for the great video
You're very welcome :)
can we use dict instead of list to store the occurrence of char in the string
Really helpful and well explained
Glad to hear it, thanks a ton!
It's easy to understand, thank you!
Comparing two arrays and checking if they are equal should ideally be O(n1) right? What am I understanding wrong?
In this case loop only will only runs 26 times since we are comparing arrays that has only 26 values (lower case english alphabets)
Why we build up s2 count array in the first for loop? Why can't we just build it from start in the second loop?
It's just easier this way iirc
for i in range(abs(len(s2)-len(s1))+1):
if sorted(s1)==sorted(s2[i:i+len(s1)]):
return True
return False
take alook mr.greg just tried
why we not using maps ?
Could someone please explain to me why this is faster than the solution I wrote?
def check_inclusion(s1: str, s2: str) -> bool:
n1, n2 = len(s1), len(s2)
if n1 > n2: return False
permutations = Counter(s1)
for i in range(n2):
if permutations == Counter(s2[i:i + n1]):
return True
return False
drawing tool name please
just do this
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
check = Counter(s1)
temp = {}
k=len(s1)
for i in range(len(s2)):
if i
Good video
below is my solution with hasmaps ,can someone please help me the time complexity of my solution i am new to this concept , thanks in advance.
def string_perms(s1,s2):
if len(s2) < len(s1):
return False
d1={}
for i in s1:
d1[i] = d1.get(i,0) + 1
l=0
r=len(s1)
while r
elegant.
confusing solution
again, why don't you stick to dictionaries lol
you just got a new sub, thank you