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.
Your code is wrong because you rely on approximate values to give exact answers. If your code does produce different results elsewhere then you might be on a different architechture (ARM?) and it would still be wrong even if it should happen to incidentally give correct answers, if that's even the case.
Something is weird in Python. I get correct test results locally in VSCode with Python 3.12.7. Here with Python 3.11 the True cases are returned False by the same code. Is the is_integer() function evaluated differently here? Or was there a bug with math.cbrt() in 3.11? Or is it something else? What is going on?
That's about the non-zero elements, and you can see that in the sample test.
The description is not clear enough. The rule "preceded and followed by the same number of non-zero elements" -> does "same" refer to the zeros? Or to the non-zero groups at the beginning and end?
I don't get it. What do you want us to sum up? Please show an example with the result.
Many katas are this way, they only require pretty much some further mathematical research.
Solved it, but it's still dumb. You either see/find the magic formula or you're screwed. No programming or algorithm challenge here.
First, there is a typo in the desription. "All numbers in will be positive integers.". I guess the word "arr" is missing in there.
Second, the description create unnecessary confusion. At the beginning a range of numbers are compared to each other. But afterwards a list of number shall only be compared to one number (=n).
This kata is "Google the formula" instead of "Show your programming skill"...
Several results make no sense. Like "act(0, 6, 0, 1)": How can you throw zero dices one time? That is physically impossible. You can only reach zero points by not throwing the dices at all, no matter how many you have.
Or "act(1, 6, 0, 1)": How can you throw one dice with side values of 1-6 and reach zero points? The minimum you can reach with one throw is 1.
Or "act(0, 6, 1, 0)": You have no dice, but you reach a score of 1 by throwing them zero times? How is that supposed to work?
Or "act(1, 6, 7, 0)": You can score a maximum of 6 points with a throw, but with zero throws you can score 7 points...?
My opinion: A target of zero can only be achived with zero throws, no matter how many dices and sides you have. If the target is >0, then there should be >0 dices, otherweise return -1 or "Error". A target larger than the maximum points you can achieve should either be removed or also lead to -1 or "Error".
The desription is not correct. The description says "below n" and "smaller than n", but the tests includes n.
For n=157 the expected result is [21, 157, 173]
The instructions should be improved. It should be possible to solve the Kata without guessing and trying.
That broke all solutions...
This might be worth raising as an issue with the Python version, since other languages don't seem to have the requirement at all.
The description didn't say that the output needs to be sorted.
Loading more items...