풀이
class Solution {
public int[] solution(int[] lottos, int[] win_nums) {
int[] answer = {0,0};
int z = 0;
int c = 7;
for(int i=0; i<6; i++){
for(int j=0; j<6; j++){
if(win_nums[i] == lottos[j]){
c --;
}
}
}
for(int i=0; i<6; i++){
if(lottos[i] == 0){
z ++;
}
}
answer[0] = c-z;
answer[1] = c;
if(answer[1] == 7){
answer[1] = 6;
}
if(answer[0] == 7){
answer[0] = 6;
}
return answer;
}
}
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr