공부기록/프로그래머스

[프로그래머스] 추억 점수

메델 2024. 2. 12. 05:26
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;
    }
}