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.
Hello,
I've got two issues. Timeout and random tests that fail.
Timeout is the fun part. Random tests is the strange part and i need some help.
If I believe the output of the attempt :
My solution is wrong but I have no idea of the expected.
My solver found this solution :
What should be the expected output ?
I do katas to propose them as a training for people. To avoid that they take unclear or unconstructive katas i must try them before.
I have the same complain than other people who complains :
...
Sad, the idea behind can be cool. But in this state, it's not a good kata. At least for me
Initially, yes I missed this part.
But after re-reading the description i notice that the order was wrong. Anyway I did not update my code cause the error was not relative.
After your comment, I made the good query and yes : it pass.
But this test is very confusing :
It fail if the request if not good event if the 3 conditions in the test description are good.
This Should be 3 tests :
There should be some additionals tests :
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Thanks for your help. :)
I did not arrive to make it work with your explanation but after a quick look to your solution,
i made almost the same thing.
My concern was probably the stopping condition.
But i finish the exercice. How?
After for modification to my algorithm, i was able to get to the response of calc(10,16) and calc(11,16) (from the attempt) and I notice that i was exactly the same that the results i get with my pure math function except the last number that was not in the right base.
So i simply change into the right base the last number return by the fonction.
It solve the exercice but :
I am far from being good at math and I may have misunderstood some things in the links I have given but the results for n> 9 and n = 5 in base 10 may be wrong.
The exercise remains interesting. :)
Yes, this is the exemple written over wikipedia.
I base my first attempt on this algorithm with this exemple. It's work well for calc(4,10) and calc(4,16)
But now, let's try this algorithm with other number in base 10 : 2.
calc(2,10) should result 105263157894736842 (Verify thx oeis.org/A092697/list)
If you wrote the problem out starting at the right and worked left:
2
x2
4
This means that a number ending in 2 times 2 gives a product that ends in 4, so 4 is the next digit to the left of 2.
We also figured out that we have to deal with a 0 carry.
So in the number on the top, write a 4 with the 0 carry over the top to create the next iteration for the multiplication:
0
42
x2
84
So now we know the digit to the left of the 4 in the multiplicand is 4, with a 8 carry.
80
42
x2
84 <-- almost same answer - the only difference is in the carries.
And If i continue i have an infinite loop.
So where's the fail? :x
Don't know if i will be happy or if i will be sad thinking about the time spent on this simple exercise...
I now got a solution in full math that seem to work. My first attempt manipulated strings...
But !
Some tests always fail (22 tests pass/28).
The 6 faillings test are the 6 in base 16 where n >= 10.
For exemple : calc(10, 16) return me "1019c2d14ee410" which is "1019c2d14ee4" + "10"
EDIT : In fact, i implemented https://oeis.org/A092697 so it logicaly fail.
Does i should implement https://oeis.org/A128857 instead?
Is it possible to know the result of calc(10, 16) ?
EDIT : Forget this comment. In fact my algorithm seem to be completly wrong.
I got a solution that make pass the 'run exemples' and also the exemple i found over wikipedia.
However, it fail on the attempt (Some fail and one forever loop). I can't figure out why.
Is it possible to add more exemple (with other base & value) or a least for most of the tests that fail when submitting, give the expected?