320x100
lv.1 2021 Dev-Matching: ์น ๋ฐฑ์๋ ๊ฐ๋ฐ์(์๋ฐ๊ธฐ)
https://programmers.co.kr/learn/courses/30/lessons/77484
import java.util.*;
class Solution {
public int[] solution(int[] lottos, int[] win_nums) {
int[] answer = {0, 0};
int win_cnt = 0, zero_cnt = 0;
for (int lotto: lottos){
// ๋ชจ๋ฅด๋ ๋ฒํธ ์นด์ดํ
if(lotto == 0){
zero_cnt += 1;
}
// ๋น์ฒจ ๋ฒํธ ์นด์ดํ
else if(Arrays.stream(win_nums).anyMatch(x -> x == "lotto")){
win_cnt += 1;
}
}
int min_rank = 7 - win_cnt;
int max_rank = 7 - (win_cnt + zero_cnt);
if(min_rank == 7) min_rank = 6;
if(max_rank == 7) max_rank = 6;
answer = new int[]{max_rank, min_rank};
return answer;
}
}
๋ฐ์ํ
'๐ ์ฝํ ์ฐ์ต์ฅ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค] ์ซ์ ๋ฌธ์์ด๊ณผ ์๋จ์ด (0) | 2022.05.09 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] ์์ฃผํ์ง ๋ชปํ ์ ์ (0) | 2022.05.06 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์ ๊ณ ๊ฒฐ๊ณผ ๋ฐ๊ธฐ (0) | 2022.05.06 |
[CodeUp] python ๊ธฐ์ด 100์ : #6027~ #6064 (0) | 2021.07.18 |
[CodeUp] python ๊ธฐ์ด 100์ : #6001 ~ #6026 (0) | 2021.07.03 |