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.
the same solution
.
Negative numbers definitely aren't prime, but for the purposes of this kata they are. I agree, it's a bit questionable, but I suppose it helps to make it trickier.. if only slightly.
Thanks. It is one of the classical katas, so I try to find new ways to solve it.
I really enjoyed this one! Although my own solution ultimately didn't work and I resorted to comparing existing algorithms and implementations, I learned a lot.
I definitely agree with other commenters - these kinds of problems often seems to be about finding the right algorithm.
That's a cool solution!
I assume it has been generated somehow. How does it work? :D
Thanks for the quick reply! :)
The name of test is changed :) Sorry for confusion. I will be more careful in the future when I will be stealing someone's tests :P
Thanks! The name of test is changed.
This comment is hidden because it contains spoiler information about the solution
I might have found a solution, see my issue above!
This could be related to
@MikeHathaway
's comment below, but my case is a little bit different. I don't get the"u r using restricted stuff"
error message but i do have500
/501
tests passing.After looking closer at the failing test, I realised that the issue is with the tests themselves:
This is the second sample test
The third basic test for the attempt-suite fails as well.
Negative numbers aren't prime. The expected results of these tests should therefore be
false
.In addition to that, the instructions has an invalid example with a negative number as well. It's a good idea to test with negative numbers - but only if the test cases have correct assertions.
Could you show your code for reference? :)
Interesting approach! Not the shortest but still quite clean :)
This repetition is a good example of when it's recommended to use an abstraction to separate the logic (your
if
s andelse
s) from the data of a similar format (the roman numerals and the values they represent).Since the data is in a clear
key: value
format, an object{}
would be great.Good luck, and happy coding! :)
Loading more items...