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.
Super concise and enjoy the use of str_repeat from matches.
[1] Total Execution Time find_uniq: 5.8177680969238
[2] Total Execution Time find_uniq: 28.545898914337
Where [1] is my solution vs [2] this solution, iterated over 100000000 array elements
Now it doesn't (sometimes, depending on selected PHP's version), because performance test were added later.
Please use spoiler flag next time, and read this:
This comment is hidden because it contains spoiler information about the solution
This code does not work
That will also fail on decimals, I known because it was my first try as well :')
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I see. I misunderstood the kata.
The test isn't comprehensive. This solution will fail this test:
$this->assertEquals(2, find_uniq([1, 1, 1, 2, 1, 1, 3, 3]));
This comment is hidden because it contains spoiler information about the solution
Will give incorrect result for 'CCD' (for example). It will return 200, but should 300.
Loading more items...