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.
Yes,me too
I like this one
I ran some tests to try and find the best solution. I think I have found the best solution on this test so far. My solution is obviously not the best solution out there, but it does seem to run a bit faster. Here are my test results, running each function 10 million times:
Starting test accounting...
Test acounting has taken: S0 ns18847747
Test accounting will be subtracted from actual test results
Starting countByZero...
countByZero has taken: 205182690933 NanoSeconds
Starting countByOne...
countByOne has taken: 177735822862 Nanoseconds
Starting countByTwo...
countByTwo has taken: 215657184532 Nanoseconds
Starting countByThree...
countByThree has taken: 234678624360 Nanoseconds
Repo that holds the tests, you should test your own too!
https://github.com/MicroBit512/countByTesting/tree/main
Notes.
I made the first three functions. I submitted the function called countByTwo. I named your function countByThree.
This comment is hidden because it contains spoiler information about the solution
No need to have the 2nd and 3rd import statements I believe.