Nice kata! But I just used my solution of the same kata but for next bigger number, as it is, only had to make a super minor change in 1 line 🤷♂️
Wow ... very saucy getting this thing to work ... and work efficiently. I'm going to take a few days off. lol
You might have created an O(n^2) solution, which would be easy to do for this Kata. Try to refactor for a more efficient way.
And I KNEW this. I always forget ...
Your n calculation is slightly wrong.
There is a lot of subtlety in this Kata! Instructive...
I'm glad that you take the time to read others' solutions. With a good attitude and a desire to improve, you'll come up with some great solutions to other kata.
@slowold .. Exacto
This make me look as an stupid person. It is the worst part, when you look that someone can solve the problem with just 4 lines of code.
In python initial solution should be:
def calc_special(last_digit, base):
with correct case and spacing.
maybe wrong way,because the test are really long integers
My initial attempt was:
This passed all but the empty-string case.
Then I added the same implementation as we see in the above implementation (passing a space into string.split) -- which passes all the tests.
No multiply instructions -- just bitwise operations, adds, conditionals and recursion
Finally, found a piece of code that doesn't look like some trainee rudiment. A breath of fresh air, thank you.