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 doesn't really answer my question. I think. I can't actually see my own question since it apparently contains spoilers and I've not solved the kata. Even though it's my own post. I posted it a year and a half ago, as well.
If I remember correctly, I was asking for tips how to make it faster, since O(2n) was timing out. Telling me that O(2n) is linear does not help me at all.
"Where do I get an umbrella - I don't want to get wet?"
"It's raining outside." <- not an answer
O(2n)
algorithms are linear too.Not as short as some of the others I see here but it has linear time complexity, whereas other duplicate checks will result in quadratic complexity. Likely an overkill to optimise for it, but I was just trying out Lodash FP mostly.
This comment is hidden because it contains spoiler information about the solution
This issue is completely valid - a static method, equivalent to (for example)
Arrays.sort
in Java ,would simply beArray.remove_
in JavaScript. Attaching to the prototype means the method is available on each instance and each instance only. It would be the equivalent of sorting arrays in Java in the following mannerThis comment is hidden because it contains spoiler information about the solution
The date part is just atrocious. It's not even hard to do but the expectation is not clear. Especially since the unit tests assume some random date and the tests when attempting the solution expect today's date. But then the time is also pretty random - I honestly don't know what time the initial tests want. The others just use 00:00:00 which, while sensible, is not explained at any point in the description. And of course it doesn't match the example tests.
I spent a third of my time doing the solution and two thirds of it just trying to match the date to what was "expected". And the expectation is rather arbitrary - the date format in a cookie can use the output of Date#toUTCString() which matches the required RFC 2616 date format but that's not considered correct here for some reason.
Either the description should go into more detail in how the date is to be handled, or the tests should be more lenient.
This comment is hidden because it contains spoiler information about the solution
Duplicate issue.
JavaScript version seems broken - you can choose it but after reload the selection is empty.
This comment is hidden because it contains spoiler information about the solution
If this solution is accepted, then the tests are incorrect.
'Africa' && 'Americas' && 'Asia' && 'Europe' && 'Oceania'
will return'Oceania'
every time because of the boolean operators don't convert their operands and only return the truthy or falsey value off those. So this solution is at best "clever" because it exploits bad acception criteria.