Practice Permutation in String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1's permutations is the substring of s2.
Source: Permutation in String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s1 = "ab", s2 = "eidbaooo"
Output
true
# Example 2
Input
s1 = "ab", s2 = "eidboaoo"
Output
false
Constraints
1 <= s1.length, s2.length <= 10^4
s1 and s2 consist of lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Permutation in String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.