JAVA_Detect Capital_LeetCode 520 풀이 class Solution { public boolean detectCapitalUse(String word) { int cnt = 0; for(char ch : word.toCharArray()) { if(Character.isUpperCase(ch)) cnt++; } if(cnt == word.length() || cnt == 0) return true; return cnt == 1 && Character.isUpperCase(word.charAt(0)); } } * 출처 Detect Capital - LeetCode Detect Capital - We define the usage of capitals in a word to be right when one of the following cases holds: * All letters in this word are capitals, like "USA". * All ...
#DetectCapital_LeetCode520
#JAVA
#JAVA_DetectCapital
#JAVA_DetectCapital_LeetCode520
#JAVA_LeetCode520
원문링크 : JAVA_Detect Capital_LeetCode 520