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.
not work for more than 5 length number, its not best practice
dose not work for many test case like: 59
by using slice method, the function can be faster. because in your solution, every loop from filter is start from 0 to end
you can just return result from reduce:
return cou.reduce((a, b) => a + b) === 10;
very slow
does not work for 100, 1000, etc.. returns 0, because of initialization of number = 0
can anyone explain to me the purpose of this line in this code
"if (line.indexOf(' ') >= 0)"
i know what is indexof. but not in this code
when i tested this code without that line, it gaves me Timeout
dosent work if: isValidWalk(['n', 'n', 'n', 'n', 'w', 's', 's', 's', 's', 'e'])