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.
This comment is hidden because it contains spoiler information about the solution
Easy to read
I'm closing as nobody else mentioned crashing tests ever since.
This kata confuses me a lot. Why is it forcing us to not use if statements to solve this problem? Using switch...case function throws out an error to the compiler which is not a best practice and shouldn't teach beginners to do it like that.
Haha why would this answer be on here if it's not a solution?
??? returning reference to stack variable ???
This function is not an error handler nor is it designed to scale.
This is neither clever, nor good practice. It might work for the given problem but every addition to this code will break it or force the person to rewrite it the normal way. -rep
Ok now.
Neat, didn't know you could do that - read the docs!
Hey John, funny I came on here as I noticed some of the solutions didn't account for when the triple and the double are different, and I see you already caught it. Nice solution by the way.
Test cases (that aren't the sample ones) are only editable in Ruby right now (the others are locked). But nice catch.
I am noticing this same problem with python kata. I am passing the 4 examples and all basic tests:
And, passing about 4 - 8 random tests. However other random tests between ranges of about
500 - 1000
, I am failing. There are no timeout issues, my algorithm simply returns the wrong number of primes. Strange how I'm passing some tests yet failing others despite their ranges being within the same numbers?UPDATE: I ended up passing this one, without changing my code, similar to the above user, Cptnprice.
I suggest adding a test that has different repeated numbers for both input cases.
For example:
222
and88
0
.1
had such a case existed.I don't believe these cases exists because I built code to return
True
(i.e.1
) for these cases, and didn't realize it was wrong until my code passed all tests, I submitted it, and saw the other solutions didn't account for such cases.Loading more items...