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.
yeah tests are bad, I made myself correct ones:
public function testBasic()
{
$decomposeArray = Sq2Squares::decompose(50);
$this->assertEquals([1, 3, 5, 8, 49], $decomposeArray);
$this->assertEquals([2, 3, 5, 7, 43], Sq2Squares::decompose(44));
$this->assertEquals(null, Sq2Squares::decompose(2));
}
Wow. you managed to calculate all the required positions. Respect.
cool solution :D
substr_count will make this very slow
will be slow for sure
this should be very slow