Description
Lotto 6/45
(Hereinafter 'Lotto') is a popular lottery game where six numbers are drawn from a pool of 45 numbers. The lottery prize tiers are as follows1:
Prize Tiers | Requirement |
---|---|
1 | All six numbers match |
2 | Five numbers match |
3 | Four numbers match |
4 | Three numbers match |
5 | Two numbers match |
6 (no prize) | All other cases |
You bought a lotto ticket and have been waiting for the draw. However, your little brother drew scribbles all over your ticket so that you can't make out some of its numbers. After the draw, you wanted to figure out the highest prize you could have won as well as the lowest prize you could have got.
Suppose that your ticket contained the following set of numbers: 44, 1, 0, 0, 31 25
, where 0
s represent the numbers on your ticket that you can't make out. If the six winning lottery numbers are 31, 10, 45, 1, 6, and 19
, then the following shows the highest and the lowest prize you could have won.
Winning numbers | 31 | 10 | 45 | 1 | 6 | 19 | Result |
---|---|---|---|---|---|---|---|
Highest prize | 31 | 0→10 | 44 | 1 | 0→6 | 25 | four matching numbers, wins the 3rd prize |
Lowest prize | 31 | 0→11 | 44 | 1 | 0→7 | 25 | two matching numbers, wins the 5th prize |
- The order in which the numbers are drawn is irrelevant.
- Had the numbers you can't make out been 10 and 6, you could have won the 3rd prize.
- There are other possibilities where you could have won the 3rd prize. However, you would not have won a prize higher than the 3rd one.
- Had the numbers you can't make out been 11 and 7, you could have won the 5th prize.
- There are other possibilities where you could have won the 5th prize. However, you would not have won any prize (Tier 6).
Suppose parameters lottos
and win_nums
are given, where lottos
is an array containing the numbers on your ticket and win_nums
an array containing the winning numbers. Please write a function solution
that returns the highest prize tier and the lowest prize tier that you could have won.
Constraints
lottos
is an integer array whose length is 6.- The elements of
lottos
are integers between 0 and 45.- 0 represents the number you can't make out.
- Other than 0s, no integers in
lottos
overlap. - The elements of
lottos
may not be arranged in a certain order.
win_nums
is an integer array whose length is 6.- The elements of
win_nums
are integers between 1 and 45.- No integers in
win_nums
will overlap. - The elements of
win_nums
may not be arranged in a certain order.
- No integers in
Examples
lottos | win_nums | result |
---|---|---|
[44, 1, 0, 0, 31, 25] | [31, 10, 45, 1, 6, 19] | [3, 5] |
[0, 0, 0, 0, 0, 0] | [38, 19, 20, 40, 15, 25] | [1, 6] |
[45, 4, 35, 20, 3, 9] | [20, 9, 3, 45, 4, 35] | [1, 1] |
Example #1
Demonstrated in the prompt above.
Example #2
Had the numbers you can't make out been as follows, you could have won the 1st prize or no prize (Tier 6):
Winning numbers | 38 | 19 | 20 | 40 | 15 | 25 | Result |
---|---|---|---|---|---|---|---|
Highest prize | 0→38 | 0→19 | 0→20 | 0→40 | 0→15 | 0→25 | 6 numbers match, wins the 1st prize |
Lowest prize | 0→21 | 0→22 | 0→23 | 0→24 | 0→26 | 0→27 | 0 numbers match, wins no prize (Tier 6) |
Example #3
Since all the numbers on your ticket match, both the highest prize and the lowest prize you could win are the 1st prize.
-
Although the following may be different than how Lotto actually works, please proceed with the rules you are provided with in this prompt. ↩
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.