Hi - could you help me with this kata please - 77633658797932970 split into 77633658 - 7 + 97932970 = 175566621 => 1755^2 + 6 + 6621 = 3086652 => 308 + 6 - 652 = -338 => -3 - 3 + 8 = 2 / how this is possible that the result is 8?
It is recommended to use a StringBuilder when altering strings in loops. This is because the StringBuilder is mutable while strings are immutable. Hence, if you use a string and append to it, every iteration in the loop creates a new string object. This is far less effective than just appending a char to a mutable object.
Great Kata...though my code get too large but ..
Python translation. Please, review and approve (the author is inactive).
It should be stated that other steps should still apply if this condition is true.
It's "subtract", not "reduce".
In the initial solution the brackets and white-space are inconsistent. It would be better like this:
Added random test.
There are no random tests.
I was struggling a bit, but author of this Kata has given me excellent explanation - i suggest to check my issue if someone of you are struggling too.
@AdmiralRobinson, you've asked for help on my Kata (Give me a Crazy Formula!) and I just did that. Take a look there later! Cya :)
@AdmiralRobinson, I'll help you, below is why the result is 8:
77633658797932970, middle number is odd (7), so we reduce it (second rule): 7+7+6+3+3+6+5+8(-7)+9+7+9+3+2+9+7+0 = 84
84, there isn't a middle number in it and n > 9 so we remove the last digit (first rule) => 8
So 8 is the answer.
Hi - could you help me with this kata please - 77633658797932970 split into 77633658 - 7 + 97932970 = 175566621 => 1755^2 + 6 + 6621 = 3086652 => 308 + 6 - 652 = -338 => -3 - 3 + 8 = 2 / how this is possible that the result is 8?
It is recommended to use a StringBuilder when altering strings in loops. This is because the StringBuilder is mutable while strings are immutable. Hence, if you use a string and append to it, every iteration in the loop creates a new string object. This is far less effective than just appending a char to a mutable object.
Thanks for the feedback. Fixed!
in the code , "public static" should be "public"