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.
I agree but this will never be production code anyway. This is codewars and the whole game is to produce short code, just to teach others clever ways of doing coding.
best practice? you can't hardly write less readable code. i'm actually a fan of short and clever code but this is just overly hacked. sorry, just may opinion.
what a---well, not smart---solution...
This comment is hidden because it contains spoiler information about the solution
Hi, when I run the sample tests (+ several manually added ones) I get all tests passed. Still, whenever I say "attempt" I do get
Server Execution Error:
exec_failure
Request Error:
Request failed with status code 500
This error was caused due to an issue processing the web request, not because of an issue executing your code. You can retry the request.
Any idea of how to get the reason for this? Could this be a timeout issue?
if you would calculate tSpent in seconds you wouldn't need the terrible workaround.
So many solutions iterate over the whole array. Using .every may save you thousands of iterations.
I chose .some to have an early exit. I find here many solutions using .filter twice over the whole array which seems to be overly expensive