567 Permutation in String
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string.
Note: 1. The input strings only contain lower case letters. 2. The length of both given strings is in range [1, 10,000].
Brute Force Approach: Every substring of length |s1| in |s2| and find at least one instance of where the sorted substring == sorted s1.
Time Complexity: Let s1 be len(s1) and s2 be len(s2). O((s1-s2)*s1logs1 + s1(s1-s2)) for sorting each substring and string comparison.
Last updated