Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
9 is squared 3, 9 is squared 3, 4 is squared 2
This comment is hidden because it contains spoiler information about the solution
You can use the '%' operator. Look my solution
What is the g sequence? I don't understand it
Instead of
Instead of
cash[25] ++;
cash[50] ++;
cash[100] ++;
you can use
cash[people]++; at the begining or at the end in the for block
If you did it, you would be able to remove the first case in the switch
It looks like my own solution!
But you should check
reg[25] >= 3 not reg[25] == 3
and
reg[50] >= 1 && reg[25] >= 1
also you have a string
if (reg[25] == 3) reg[50] += -3;
you check reg[25], but act on reg[50] !
Your solution failed on this test
On each iteration you find a change in a list. The complexity is O(n^2)
Dictionary should be better.
Check my solution.
You can compare chars e.g. 'a' < 'z';