Permutation in String

Medium · Arrays & Strings · about 15 minutes

Asked at Meta, Microsoft, Amazon, Google, Apple, Bloomberg, Jane Street.

Both strings are lowercase. Decide whether some contiguous piece of s2 uses exactly the same letters as s1, with the same counts, in any order.

Related guides