Permutation In String
Return whether a contiguous substring of s2 is a permutation of s1.
Example 1
s1 = "ac"
s2 = "zzcayy"trueExplanation
ca appears contiguously in zzcayy and is a permutation of ac.
Example 2
s1 = "ac"
s2 = "abbbcc"falseExplanation
a and c occur but never together in a length-two window.
Example 3
s1 = "aa"
s2 = "baa"trueExplanation
The final aa window matches the two required a occurrences.
Constraints
- 1 <= string lengths <= 10000
- Strings contain lowercase English letters
Function contract
checkInclusionArguments: json, jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 35 cases, on your device.
"ac""zzcayy"