JAVA_Ransom Note_LeetCode 383 풀이 class Solution { public boolean canConstruct(String ransomNote, String magazine) { if (ransomNote.length() > magazine.length()) return false; int[] cnt = new int[26]; for (char c : magazine.toCharArray()) cnt[c-'a']++; for (char c : ransomNote.toCharArray()){ if (cnt[c-'a'] == 0) return false; cnt[c-'a']--; } return true; } } * 출처 Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next int...
#JAVA
#JAVA_LeetCode383
#JAVA_RansomNote
#JAVA_RansomNote_LeetCode383
#RansomNote_LeetCode383
원문링크 : JAVA_Ransom Note_LeetCode 383