#3297

Count Substrings That Can Be Rearranged to Contain a String I

specialist · 990 · lc medium +32 · 42.7% accepted · 123 likes · top 24%

Description

You are given strings word1 and word2. String x is valid if its characters can be rearranged so word2 is a prefix. Return the total count of valid substrings of word1.

Code

1
2
3