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 lists in this case could have 10000 elements, so printing them would be too verbose.
https://docs.codewars.com/training/troubleshooting#print-input
If you're looking for the version where O(n) is expected, it's this kata.
You can start by really reading into the description :D
I saw it. My point was that the tests passed the right arrays, and expected results were correct, so the issue wasn't with the kata itself. I agree that every
var
should be replaced withconst / let
but that's a minor issue (especially considering that the kata is in beta for 7 or so years).I'm not an oracle, so I don't know. Global variables? Confusion?
You can always go to Solutions tab and fork any solution, and play around with it. You can modify tests as you see fit (you will notice that adding
const
doesn't change anything). Tests pass a copy of the array, so the expected result isn't affected by your code.See above. I marked it as spoiler just in case. The "issue" seems to come from your code.
This comment is hidden because it contains spoiler information about the solution
You can forfeit and see solutions, that's one way. Or you can visit your favorite JavaScript community and ask for help. Or you can visit the
#javascript
channel of Codewars Discord and ask for tips.Yeah, that wouldn't really fix the problem...
const
in JS doesn't mean what you think it does.What's the problem?
this would invalidate all current, valid solutions to a blue kata and require editing of all four languages, just for a cosmetic change. Why should we do that ?
Given that this is tagged as puzzle (and restricted), I don't think there's any hint we're able to provide.
Resolving the suggestion as unsound.
But why? The to-go solution for this problem is not based directly on GCD, many solutions do not calculate GCD at all, and I think that tests in many languages would time out solutions based on calculations of GCD.
Loading more items...