import java.util.*;
class Solution {
public int[] solution(String[] name, int[] yearning, String[][] photo) {
int[] answer = new int [photo.length];
for(int i=0; i<photo.length; i++){
for(int j=0; j<photo[i].length; j++){
int find = Arrays.asList(name).indexOf(photo[i][j]);
if(find != -1){
answer[i] += yearning[find];
}
}
}
return answer;
}
}
'공부기록 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 소수 만들기 (0) | 2024.02.12 |
---|---|
[프로그래머스] 과일 장수 (0) | 2024.02.12 |
[프로그래머스] 푸드 파이트 대회 (0) | 2024.02.04 |
[프로그래머스] 콜라 문제 (0) | 2024.02.04 |
[프로그래머스] 스킬트리 (0) | 2024.02.03 |