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.
interesting answer, thank you. But it looks mush more complicated than a straightforward two loops with pushing back into vector. Simplier solution is much fatser to read. Is there any performance benefits I simply don't know about?
Yes,that's clear now. thanks a lot!)
Was interested with your commented solution. After some searching I understood, that I don't understand how could it work in Chrome.
-In JS 'arguments' is not an Array but Array-like object, it has only 'length' property. To convert easily there is a variant using spread operator '...'.
-When you use Math functions you can't call them without Math (i.e., Math.max(args)).
-Math object doesn't have sum() function at all, the best practice I found is using reduce (just as you used above).
I tried to adjust all that and here is a working modification (but imo it's not so elegant)
function isTriangle(a,b,c){
return Math.max(...arguments) < Array.prototype.reduce.call(arguments,(a,b)=> a+b)-Math.max(...arguments);
}
PS: never thought about max() function and I like your implementation.
Do this works without spliting the string (because the string is inerable by it self) or it is really necessary? If yes, explain, please.