2287. Rearrange Characters to Make Target String

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2287

class Solution:
    def rearrangeCharacters(self, s: str, target: str) -> int:
        cnt1 = Counter(s)
        cnt2 = Counter(target)
        return min(cnt1[c] // v for c, v in cnt2.items())