3
This commit is contained in:
11
solutions/lc2287.py
Normal file
11
solutions/lc2287.py
Normal 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)
|
||||
Reference in New Issue
Block a user