If you like my writing, I would really appreciate an anonymous testimonial. You can drop it here.
To learn more about the newsletter, check our detailed About Page + FAQs
To help me understand you better, please fill out this anonymous, 2-min survey. If you liked this post, make sure you hit the heart icon in this email.
Recommend this publication to Substack over here
Take the next step by subscribing here
I’m going to start with an announcement,
The newsletter giveaway has finished. Over 300 people will get this newsletter for free. To those that filled out the form, you will now have access to all the paid content in my newsletter, for the next year, no strings attached. This should help those of you struggling with the economic uncertainty of today. Use all the knowledge already shared that I will continue to share to boost your career.
Getting back to today’s question. How did you do on this question? Did you get the solution? Let me know by replying to this email.
This problem can be found as problem 567. Permutation in String
Problem
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
.
Example 1:
Input: s1 = "ab", s2 = "eidbaooo"
Output: true
Explanation: s2 contains one permutation of s1 ("ba").
Example 2:
Input: s1 = "ab", s2 = "eidboaoo"
Output: false
Constraints:
1 <= s1.length, s2.length <= 104
s1
ands2
consist of lowercase English letters.
Keep reading with a 7-day free trial
Subscribe to Technology Made Simple to keep reading this post and get 7 days of free access to the full post archives.