3365. Rearrange K Substrings to Form Target String
You are given two strings
s
andt
, both of which are anagrams of each other, and an integerk
.Your task is to determine whether it is possible to split the string
s
intok
equal-sized substrings, rearrange the substrings, and concatenate them in any order to create a new string that matches the given stringt
.Return
true
if this is possible, otherwise, returnfalse
.An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using all the original letters exactly once.
A substring is a contiguous non-empty sequence of characters within a string.
1 | class Solution { |