1
class Solution {
2
public int rearrangeCharacters(String s, String target) {
3
int[] freq = new int[26], freq2 = new int[26];
4
for (char ch : s.toCharArray()) freq[ch - 'a']++;
5
for (char ch : target.toCharArray()) freq2[ch - 'a']++;
6

7
int min = Integer.MAX_VALUE;
8
for (char ch : target.toCharArray()) min = Math.min(min, freq[ch - 'a'] / freq2[ch - 'a']);
9

10
return min;
11
}
12
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0