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.
@dansel I get your point, you can approach the kata in whichever way you want as long as it's not forbidden. But the problem is your solution is voted as best practice, which certainly isn't. That's why people protest.
very elegant, however will be too slow given a couple of million array elements.
'filter' creates a new array + iterates through the total array.
the 'reduce' solution stops when needed and returns a boolean.
make test cases from the examples (JS version)
Thanks for your reply.
Since speed is not mentioned in the kata description I did not care about execution time.
It's a 7 kyu kata and it's "fast enough".
This solution is KISS and easy on the eyes though.
One could of course implement faster solutions with "fail fast".
Slow
the description should state "without moving the pizza pieces"
otherwise one could double the number of pieces with each cut.
then it is as simple as: two to the power of cuts