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.
Wait I think I figured it out...
Another example of why I'm confused:
test case where input = 451054599
correct result is 21
my result 112
451054599 % 13 = 8
21 % 13 = 8
112 % 13 = 8
I just meant it's funny that if I input my incorrect result as input, the new result is the correct answer.
My code is working on everything besides 33 of the random tests. I logged n to see what the input is and it doesn't seem any different than the other test inputs other than it being a different number. Can't figure out what is causing the majority of inputs to work, but not for a few.
Anyone know the difference here between the random tests and basic tests?
I'm passing all basic tests and 168 / 201 random tests.
failed random test example: expected 113 to equal 22.
Locally if I input 113 as n the result is 22.
What am I doing wrong?
Going by the instructions given, the result is incorrect.
I'm sure that is part of the reason this is only rated at 85%.
The instructions don't say either a-b or b-a, they say very clearly a-b. They don't mention the difference having to be a positive number.
in my example:
a-b = (-1272 - 7169) = -8441. Does it not?
-8441 is less than the given margin (1339). Is it not?
According to the instructions given, these params would return 0.
.
.
This isn't a problem about distance, it's a problem about integers and negative integers are very real.
The tests are setup wrong for this problem. For example:
a = -1272
b = 7169
margin = 1339
Difference between a & b = -8441
1339 > -8441 therefore according to the instructions (if the margin is higher or = to the difference, return 0), this should return 0 but the passing result is -1.
Simply genius
This is the only 100% correct solution.
Simple enough until the random test case hits you with the year 3845682734695.
I would call this one harder than 8kyu.