Permutation in String
Check whether some window of s2 holds exactly the same letters, in the same amounts, as s1.
The problem
Implement Solution.checkInclusion(s1, s2). Return True if some substring of s2 is a rearrangement of s1, meaning it uses exactly the same letters the same number of times, and False otherwise. For example, s1 = "ab" and s2 = "eidbaooo" returns True because s2 contains "ba". Both strings contain only lowercase English letters, and 1 <= len(s1), len(s2) <= 10000.
Starter code
class Solution:
def checkInclusion(self, s1, s2):
passPublic examples
s1 = "ab", s2 = "eidbaooo"givesTrues1 = "abc", s2 = "bca"givesTrues1 = "abcd", s2 = "abc"givesFalse
Solving it in the practice book needs an active paid plan.
Open it in the practice bookOne thought at a time.
