Solution#1
public class Solution {
public boolean canConstruct(String ransomNote, String magazine) {
int[] table = new int[26];
// char[] mc = magezine.toCharArray();
for (char c : magazine.toCharArray()) {
table[c - 'a']++;
}
for (char c : ransomNote.toCharArray()) {
if (--table[c - 'a'] < 0)
return false;
}
return true;
}
}
Problem#1