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
not the most beautiful but only one reduce instead of two.
yes, there is splitted into 3 parts because the multiplication of the other 2 parts is the same, for example:
[250][3,7,1,1] => 250 * 3 * 7 * 1 * 1 = 5,250;
[3,7][250][1,1] => 3 * 7 * 250 * 1 * 1 = 5,250;
See what I mean? Commutative Property of Multiplication can be applied.
yes, but is
O(n^2)
, includes also search in the whole used array.forEach
is also slower than forfor
3711250
, I'm generating the following partitions, I'm I missing something?I think it would be great if you could add an example with a bigger entry