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
This comment is hidden because it contains spoiler information about the solution
const isLeapYear = y => y % 16 ==0
this is also my solution but it fails lets say for the year 4 or 8 !!!
Yes it need to have test cases for this years too!
Yes, especially confusing considering in the example 'coffee' > 'eecoff' results in 2, but in the tests it expects 4 (going the opposite direction). I honestly feel like the description is asking us to go forward but the tests actually want us to go backward.
I agree, the story is nonsense and should just be replaced with a short problem description like yours: "Given a list ls of positive integers, find the length k sublist with largest sum <= t".
To me, that's actually rotating the first string BACKWARDS, not forward... But other than that, the exercise is nice.. :)
This comment is hidden because it contains spoiler information about the solution
The problem simply asks for the biggest sum of x ammount of numbers under a certain value. The story makes absolutely no sense, since you wouldn't have ALL the distance options from every city, and hence in reality you couldn't pick random distances (unless you had the option of teletransporting from town to town).
Really think about it, the story here makes no practical sense..
Well - to be fair
I did it to prove a point. In addition to solving it. (Namely, that randomised tests are A Good Thing™. :)
When viewed out of context, yes, it looks silly. :]
Absolutely silly.. You've worked it out only to give the answers, instead of actually solving it!! :P
This comment is hidden because it contains spoiler information about the solution
To return a function, you simply... return a function!! :)
For example:
I've written this answer based on another one I saw, to prove that the test is wrong. This solution actually FAILS to verify all Leap Years!!!!
Well, this solution is wrong, yes.. But actually the year 2000 IS a leap year, because it is multiple of 400..
;)