#3365

Rearrange K Substrings to Form Target String

specialist · 775 · lc medium +31 · 56.7% accepted · 87 likes · top 51%

Description

You are given two strings s and t that are anagrams of each other, and an integer k.

Determine whether it is possible to partition s into exactly k equal-sized substrings, rearrange those substrings, and concatenate them to form t.

Return true if this is achievable, otherwise return false.

An anagram is formed by rearranging all the letters of another word. A substring is a contiguous non-empty sequence of characters.

Code

1
2
3