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.
I think you should use the words 'place value' in your description. First digit, nth digit are ambiguous. All you need to do is to add 'by the first digit we mean the digit with the lowest place value.'
Oh great! I must have been getting a bit confused/over complicating it. It makes sense now! thanks
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Changed the 1st paragraph of the description to this:
The function
findDigit
takes two numbers as input,num
andnth
. It outputs the nth digit of num (counting from right to left).I hope it now becomes clearer. :)
Thanks for responding! I would probably add in a note about that as I normally do so from left to right.
I count the digits from right to left. I thought that was intuitive, because that is how numbers work. The first digit (units) appears at the most right, then you have at his left the ten's, and so on...
When you add another digit, you add it at the left, not at the right (ex. 999+1 = 1000) so I think it makes sense to count them from right to left and not otherwise.
But do you think I should change the description to make this more clear?
If that is the case, that changes it quite a bit! thank you!
I think the person who made the kata starts counting digits starting from the last digit. I have no idea why, I also found it confusing.
I think I am a bit confused by the test codes. The first one especially I am not sure it should be 5... shouldn't it be 3?
Test.assertEquals(findDigit(5673, 4), 5);
Test.assertEquals(findDigit(129, 2), 2);
Test.assertEquals(findDigit(-2825, 3), 8);