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.
forked to improve a few more things and approved
Java was approved at some point
omg XD i just make it long
So far i've passed all fixed cases(the one where you press attempt, after passing the test cases) excpet the last one and none of the random, i reckon i need to learn something about mathematics, could someone give me a hint on what subject should i study? by the way great kata
in C, i'm trying to do the exercice and on the 0 ^ 0 ^ 0 test, it should expect 0 because 0 ^ 0 ^ 0 = 0 ^ (0 ^ 0) = 0 ^ 1 = 0, but it expect one.
i assume 0 ^ 0 ^ 0 = 0 ^ (0 ^ 0) because it says in the first line of the subject :
"For a given list [x1, x2, x3, ..., xn] compute the last (decimal) digit of x1 ^ (x2 ^ (x3 ^ (... ^ xn)))."
This was a very interesting problem to solve, giving great insights on a follow up to this kata:
1- Same problem statement, however making it even bigger. This time with itegers so large that they cannot be exponentiated in Python. Like the square would overflow Python's math. Assume you have 64-bits of dynamic range to craft a solution.
2- Do #1 above with only 8-bit dynamic range.
Submission tests show you what was the failing array:
Example tests do not show the array, but you can see the code of the exampel tests, you can modify it at will, so you have everything what's needed to figure out which assertion is failing.
Your code using
Math.Powhas no chance to work. It will lose precision very quickly and give inaccurate result. Alsonum.ToString()called on a largedoublewill not work in an expected way.You need a uch better idea, and for sure one which does not use floatign point numbers.
You can always see what test goes wrong by doing
Console.WriteLine(arr).in C#, the tests are all in one attempt
Test Failed
Assert.That(Calculator.LastDigit(allCases[i].test), Is.EqualTo(allCases[i].expect))
Expected: 1
But was: 0
this means I can't see which test I got wrong, which makes it hard to figure out how to solve the code.
Not a kata issue. Closing.
Strictly a mathematical challenge more or less.
Thanks! That was very helpful.
19th test is
[2,2,101,2]and the last digit is 6: https://www.wolframalpha.com/input?i=2%5E2%5E101%5E2You can print the input array to see what tests pass to your solution.
This comment is hidden because it contains spoiler information about the solution
Loading more items...