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.
in the question, it says that
i
will be an integer, so there is no reason to parseInt() itNot an issue.
?
Edit: Did you return a string instead?
But, if n<=0 . This will return a not-null array.
It's bad practic to return number as string.
Basic Test
Tests for integers
Finds the index of middle element - Expected: 0, instead got: 0
Finds the index of middle element - Expected: 1, instead got: 1
Tests for floats
Finds the index of middle element for floats - Expected: 0, instead got: 0
Finds the index of middle element for floats - Expected: 1, instead got: 1
Tests for negative numbers
Finds the index of middle element for negative numbers - Expected: 0, instead got: 0
Finds the index of middle element for negative numbers - Expected: 1, instead got: 1
Tests for mixed numbers
Finds the index of middle element for mixed numbers - Expected: 0, instead got: 0
Finds the index of middle element for mixed numbers - Expected: 0, instead got: 0
Dafuq :/