I'm sure most people here are better educated in mathematics than I, but I at least do know it's all math here. If there is pure math or unpure math, okay, I don't know. The point of this was: not to use functions. That having been said, I would like to know why MasterZeNoX considers his code "purer". Thanks all :)
Codewars has some stuff before your solution, so the line numbers are inaccurate. Also, not an issue.
Please post your code with a spoiler flag so we can help.
.
The final test does, but randomized. Maybe you were so lucky that not a single test out of 200 test cases generated a number.
The Dart Translationr didn't appear in the kata
Ranks can't be changed though.
I'm sure most people here are better educated in mathematics than I, but I at least do know it's all math here. If there is pure math or unpure math, okay, I don't know. The point of this was: not to use functions. That having been said, I would like to know why MasterZeNoX considers his code "purer". Thanks all :)
@rowcased It's all math, though...
floor
andlog10
is just math, not JS. What's not pure math about it?what pure? looks like you used a couple methods there...
A "purer" maths approach would be
Math.floor(Math.log10(x)) + 1
But I have reservations about initing two related variables separately. Define
y = 10**(n-1)
. Also,x = 0 => n = -323
?!?Codewars has some stuff before your solution, so the line numbers are inaccurate. Also, not an issue.
Please post your code with a spoiler flag so we can help.