인프런 커뮤니티 질문&답변
이런 방식도 괜찮을까요?
작성
·
245
1
이런 방식도 괜찮을까요?
public String solution(String str){
String answer = "";
for(String s : str.split(" ")){
if(s.length() > answer.length()) answer = s;
}
return answer;
}
퀴즈
What is the most efficient way to count the total number of specific characters in a string, ignoring case?
Iterate through the string and compare each character to both the uppercase and lowercase of the target character.
Convert the entire string to a single case (e.g., all uppercase) and count the characters.
Count uppercase and lowercase letters respectively and sum them.
Using a Set data structure, store characters without duplicates and then count them.





