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.
This is not optimized for Haskell
I'm having some issues with JavaScript random tests that appear to have BigInt inputs and expect BigInt results because returning a Number yields:
lastDigit(5143600, 0: expected 1 to equal {}
If I convert the results to BigInt when the inputs are BigInt, this error is thrown:
TypeError: Do not know how to serialize a BigInt at JSON.stringify
Seems to be related to this issue with JSON.stringify and BigInt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/BigInt_not_serializable, so maybe a test issue rather than a problem with my solution?
Please look at the last example in description, and try to apply some common sense. Does it look like you can calculate such result, possibly 100 of times, in under 12 seconds? Very unlikely. You need a different approach altogether. (Ask yourself, why would this be 5kyu if your code worked?)
It's too simple.
why i get Execution Timed Out
for this code in python:
return (n1**n2)%10
i think there is no Simpler code than i wrote?
Issue is with your skill, not the kata.
The algorithm you've written is way too inefficient for a problem like this. The tests are deliberately written to fail solutions like these. Once you optimize your solution, it should pass in ~2 seconds. You're probably testing with small values on Visual Studio - the tests on Codewars will try massive numbers.
C#, Execution Timed Out but all works good in Visual Studio with same numbers..
c# tests in not optimised..
Ok Thanks
This is literally what this challenge asks you to figure out :)
You can try to write some small values on paper and see if some patterns emerge.
This comment is hidden because it contains spoiler information about the solution
If my understanding is correct, when the 2nd parameter ("b", in your case) is 2 or 3, the expected value of n3 should be equal to n2, but n3 is actually set to 0 by your code.
I've had a quick look, but can't say why yet. I did notice the code fails perhaps consistently when
a
is a larger number andb
is either2
or3
. Hope that helps.This comment is hidden because it contains spoiler information about the solution
I ran your code and it yields the error below. Tests have been updated since, do find a pattern in doing such exponentations.
Loading more items...