This commit is contained in:
Vombit
2026-05-25 14:40:33 +05:00
parent ec7f45e03a
commit 352ed5d27c

11
solutions/lc2287.py Normal file
View File

@@ -0,0 +1,11 @@
class Solution:
def rearrangeCharacters(self, s: str, target: str) -> int:
s_set = {}
for i in s:
s_set[i] = s_set.get(i, 0) + 1
t_set = {}
for j in target:
t_set[j] = t_set.get(j, 0) + 1
return min(s_set.get(ch, 0) // t_set[ch] for ch in t_set)