인프런 커뮤니티 질문&답변
아래와 같이 string으로서 해결을 했습니다, 이러한 방식도 괜찮을까요?
작성
·
233
2
public String solution(String str){
String answer = "";
for(char c : str.toCharArray()){
if (!answer.contains(String.valueOf(c))){
answer += c;
}
}
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.





