
hoop
In a game we called that “hoop”, n
player numbered from 1
to n
are playing. The first player says 1
, the second player says 2
and so on. After everyone says a number, it’s the first player’s turn again. There’s an additional rule that make the game more interesting: if the current number the person should say is divisible by 3
or 7
, the person should say 0
instead.
You’re given the number of players n
, the number of turns m
the game was played, and what was said in each turn. Your task is to find the players who made mistakes.
- the players should be returned in the order they made mistakes;
- if the player made several mistakes, all of them should be returned.
Example
- For
n = 3
,m = 8
andturns = [1, 2, 3, 4, 4, 0, 0, 0]
,
the output should behoop(n, m, turns) = [3, 2, 2]
.- During the first round, players
1
and2
did everything right, but the third player forgot to say0
(3
is divisible by3
, so0
should be said instead). - During the second round, player
2
said4
instead of5
, which was a mistake. - Finally, during the last round the second player said
0
instead of8
, which was a mistake.
- During the first round, players
Input/Output
-
[execution time limit] 0.5 seconds
-
[input] integer n
The number of players.
Constraints:
1 ≤ n ≤ 10
. -
[input] integer m
The number of turns.
Constraints:
1 ≤ m ≤ 50
. -
[input] array.integer turns
Array of non-negative numbers, where the
ith
number is the number said in theith
turn.Constraints:
turns.length = m
. -
[output] array.integer
- Array of players who made mistakes in the order of turns the mistakes were made in.
Post Comment