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.
Nice!
What unexpected behaviour are you talking about here? The ECMA specification says that the radix will default to 10 unless the string starts with "0x", which can't happen here as all non-numeric characters are removed.
https://262.ecma-international.org/12.0/#sec-parseint-string-radix
I am, I look for it!
Of course, as long as you are ok with your code having unexpected behavior :D
I should do what I fancy to.
You should always provide radix (10 in this case) as the second argument to parseInt.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
I don't understand also to
anOver(n)
andanOverAverage(n)
.I agree, it is hard to understand what author actually expects from us for each function.
Agreed. Description is unintelligable to me. Will have to skip this one.
I must totally agree. Either I'm too stupid to understand this instruction or it's written too poorly. I wrote the code. I think it's correct. I think the result it gives back is correct (double checked it manually), but it's not (according to tests). I have no clue why and instruction does not clarifies this for me.
Sorry, this kata's description is just written too poorly. Additionally, I don't think the test cases are all correct (for JavaScript at least).
Consider this:
Looking at the primes in
gn(104)
give:Sorting and removing duplicates yields
So, if you want us to define a function
p(n)
that returns n unique primes, it might make sense whereHowever, if you look at the primes in
gn(105)
, you getRemoving duplicates and sorting yields
So in this case, using a larger
n
in ourgn(n)
function gave us more primes (in this case, it added 7). So who's to say thatp(6)
shouldn't beThat satifies the definition of "return n unique prime numbers."
Not knowing how to seed the
gn(n)
function gives us a non-deterministicp(n)
, which makesmaxp(n)
just trying to guess what you want.Not to mention, I have no idea what
anOver(n)
is supposed to do, as well asanOverAverage(n)
This comment is hidden because it contains spoiler information about the solution
I like this one the best, this kata screams for recursion, and you hit the nail on the head.
Here is how it "snakes" through this sample city each step of the way (notice how the 8's on the right side don't get infected):
Seriously, this part is really dumb. Why would [2,4] return [2,null]? Why should it return [2,2]?
Probably because their internal test uses some dumb recursive method that doesn't take this in consideration.
This comment is hidden because it contains spoiler information about the solution
Loading more items...