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.
Warning: With enough thinking anyone can come up with a solution without knowing any specific algorithm.
This comment is hidden because it contains spoiler information about the solution
When testing to see if a number is prime, you don't actually have to test every possible divisor up to that number. You can just test every possible divisor up to the square root of that number plus one.
for num in range(2, number): --> for num in range(2, int(number ** 0.5 + 1)):
Saves a lot of time. Hope this helps.
nvm, you are probably talking about the tests having larger
int
s than were allowed in the description. Disregard my commentInstructions say "Assume that x is an unsigned, 32-bit integer".
But random tests (python, btw) are giving me 50+ bit integers for x, such as 7,138,606,154,252,560.
Thanks, I would not figure this out !
This kata was kind of brutal.
Hint for future solvers: Note that [threshold] is a percentage, not a constant.
And don't forget you can add your own tests in the Sample Tests window.
To phrase the problem a different way: You have 6 single-slice toasters. Given the number of slices of bread, return either the number of toasters still available or the number of slices of bread still waiting to be toasted. (ie: the over/under)
Note: damage_per_attack means damage given per attack, not damage received per attack.
(It's sort of obvious, but not clearly stated, and could be interpreted either way.)
Warning: The solution essentially requires some variant of one particular algorithm.
Hint: At what stage can you set aside one local maximum sum and start working on the next local maximum sum?