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.
It's not that the second 30 takes precedence exactly, it's that the team that scored 40 must be higher than both of its neighbours - and the second 30 can be deduced to have a value of 3... but as you've discovered, not by taking into account only the information on its left hand side.
How might we figure that out?
As said in description:
This means the first team (team who scored 30) will know the bonus amount of the second team (team who scored 20), the second team will know the amount of bonus from the third team (team who scored 10). Also said in description that:
First we know that the third team knew none of the other teams' score, therefore they get the lowest of
1
bonus. Secondly, the second team knew the score of third team (which means second team have a higher amount of score), therefore they needed a bonus amount higher than 1, which is2
. We can also use the same logic to get the amount of bonus for the first team, they needed a bonus higher than 2, which is3
. Then we add all the bonuses together to get:1+2+3=6k, so the answer is 6 for minimum bonus. Sorry if my explaination isn't clear enough :)
You're on the right track thinking about recursive algorithms and your deductions so far are almost correct. If
permutations(5)
is made up of(5-1) == 4
branches as you say, each having 11 leaves, how might we derive that number 11? You say it'spermutation(n-1) - <something>
butpermutations(5-1) == permutations(4) == 9
as you say, which is smaller than 11... so something is being added, not subtracted.I believe this is the 2kyu kata for anyone interested https://www.codewars.com/kata/evaluate-mathematical-expression/
Duplicate of a 2 kyu kata, except without parentheses. I can literally copy-paste my JS or Python solution from the 2 kyu one and paste here and it will immediately pass.
This comment is hidden because it contains spoiler information about the solution
I also faced the same issue. However between 307 and 317, 311 is also a prime number so 307 and 317 are not perfect 10 gap prime numbers. The question does mention about this issue. I will be putting it here so that you can understand it better.
"gap(6,100,110) --> nil or {0, 0} or ... : between 100 and 110 we have 101, 103, 107, 109 but 101-107 is not a 6-gap because there is 103 in between and 103-109 is not a 6-gap because there is 107 in between."(Taken from the original question).
So the kata expects you to return 2 primes with the gap 'g' such that there are no primes among the numbers between those numbers.
307 and 317 are not consecutive primes.
Moreover Python's interpreter makes it easy to handle, indicating the line of your code that contains the instruction that made your program crash.
This error is very clear. You tried to use .pop() on an empty list. Whereever this error comes from, it is certain that it's coming from your code.
It's not enough to just log inputs, it's also important to log all relevant variables along the way, and see the exact point where your program crashes.
dec2FactString(n) factString2Dec(n)
: these two functions were in a first version (long ago) of the kata. They have been replaced byfact_string_2_dec / dec_2_fact_string
(to have snake_case) without problem (read "testing1" and "testing2" in "Sample tests".Read the complete output of the tests, in particular the last part:
The error is in your code "solution.py", line 14.
Cheers.
That's not true, read the description and the examples again.
i as small as possible, it doesn't say d as small as possible.
You've probably already done that kata, but still, I'm having a same issue, mainly because author inserted huge numbers, so a loop is going to work for a long time. Have to find the other way, I'd say more, but I don't want to make spoilers.
@m_mistroni, sorry about this issue, I hope everything works fine for you now
Raising an issue, the control function is mutating the input.
Loading more items...