medium
Permutation in String
Given two strings s1 and s2, decide whether some contiguous substring of s2 is a rearrangement of s1.
Constraints
- 1 ≤ s1.length, s2.length ≤ 10^4
- Lowercase English letters
Examples
in: s1 = "ab", s2 = "eidbaooo"
out: true
"ba" is a permutation of "ab".
in: s1 = "ab", s2 = "eidboaoo"
out: false
Code it yourself
Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.