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.
See above, this occurs when you print the integer value.
482 is correct:
as long as
long
Hey @ihatemaths - thanks for your lovely message, it made my afternoon reading it! I thought I was one of the older people on the site, but you have me beat.
My neighbor (79 years young) decided to take up triathlon last year and now I see him every other day in my town practicing his cycling - and I live in a mountain region! - so never say never about the maths learning ;)
Happy new year and I hope you have a great 2023
Hi @ihatemaths (nice username!),
I copied your current solution locally, and performed a test with two inputs:
a=0, b=10 -> returns 3
(this is the test in the Description)a=0, b=11 -> returns 4
this is incorrect, because the kata expects 3 if I'm not mistaken. Note that here, going fromb=10 to 11
we have that11
is an upside down number.The description says: "For example,
solve(0,10) = 3
, because there are only 3 upside down numbers>= 0 and < 10
so as you can see here the upper limit is NOT inclusiveSo tl;dr, it seems your code is currently counting the upper range limit value, when it should not.
Very appropriate username by the way ;)
Easy, first use this:
You'll see there are 108 tests and the aproximate values that are tested.
To see which one your code times out with, use print like this:
print(n, flush=True)
P.S.: despite hating maths, you try a lot of math katas ;)
It is possible that you found a bug in the kata, but you need to provide enough information to both prove it and help us to locate the bad code. Please provide all of the following:
This helps determine where the issue lies. Note that Kata authors often swap expected and actual arguments in assertions (item 3); in doing so, their kata are still correct in terms of asserting algorithmic correctness (it is just that error output is misleading.) So a correct implementation still passes the tests and an incorrect implementation will still fail the tests. This is the sort of thing we can fix without invalidating everyone's solutions. This "correct kata but misleading error reports" quality exists in lots of kata on CW (perhaps half or more) - expect to see it time and again on CW.
If you don't have a (4) because of a time-out, you need to tune your algorithm to complete within the 12 seconds that CW allows.
Provide some proof your code is right and the tests are wrong then. As I said, to evaluate that, the input value is something we need. And in the link there are instruction on how to post your code, that's the only way we can see it and try to help you figure it out where the problem is.
You are most probably reading logs incorrectly and misinterpreting them. I jsut solved the kata with Python, and it seems to work correctly.
I still believe your solution does not handle some edge cases correctly. I updated tests to present (hopefully) better assertion messages, so you can try and re-run your solution and check the errors now. You can also post your code (remember about formatting and spoiler flag), and we could help you find your mistake.
Print the input and read this: https://docs.codewars.com/training/troubleshooting/
How big may depend on which language you intend to try.
In general think "big enough that a solution will require some careful coding to complete in the 12 second code wars time limit."
Larger than 32 bit numbers.
Big enough to make you cry.
For Java version it's 1e10.
Loading more items...