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.
Tests updated.
Also, it should be rewritten to be more consistent with numbers versus integers.
I saw some of the "correct anwsers" and they should not be accepted.
Please, someone write this test:
Edit:
This chanllenge needs to be rewriten if you really want to return
undefined
if any of the values aren't numbers.That was a little tricky one. I had to scratch my head for a while to find a solution. I'll made a suggestion for the newcomers read the intsructions carefully.
This depends a lot on the definition of "power of two" you establish. We could be allowing rational exponents (square roots). Even Integer exponents would start a painful process as 2^(-2) (1/4) would be a valid parameter. With the same rules we could say that exponents are only Natural, then 1 would not be a power of two.
I take your point and very much agree that we should definitely define the Range of exponents we are taking into account.
There's a bug in the test cases and width the biwised solutions. 0 is not a power of two cause any number powered to 0 equals 1, so there should be two mandatory tests:
Test.assertEquals(isPowerOfTwo(0), false);
Test.assertEquals(isPowerOfTwo(1), true);