https://school.programmers.co.kr/learn/courses/30/lessons/120869
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int solution(String[] spell, String[] dic) {
int answer = 2;
int length = spell.length;
for(int i=0;i<dic.length;i++){
int count = 0;
if(dic[i].length()==length){
for(int j=0;j<length;j++){
if(dic[i].contains(spell[j])){
count++;
}
}
if(count==length){
answer=1;
}
}
}
return answer;
}
}
'JAVA' 카테고리의 다른 글
100일 도전 알고리즘 문제풀이 (0) | 2023.09.17 |
---|---|
자바의 정석 2일차: 6장 (0) | 2023.09.13 |
[프로그래머스/자바] 안전지대 (0) | 2023.09.04 |
[프로그래머스/자바] 캐릭터의 좌표 (0) | 2023.09.03 |
[프로그래머스/자바] A로 B 만들기 (0) | 2023.09.03 |
댓글