Use spoiler flag next time, please.
This comment is hidden because it contains spoiler information about the solution
Less readable and twice as slow as just adding zeros equal to the difference in length. Still neat though. Wish people didn't use "best practice" as an upvote when best practice would prefer either better speed or readability and this is less of both.
i suppose the solution must be more native and contain basic language feature.))
See my comment when somebody complained it's O(n^2). Btw, O(2n) = O(n).
What is readable is also a matter of experience and taste. For instance, some believe writing "u" instead of "you" is better readable, others don't think so.
Why are u upvote this?
It's unreadable and O(2n)...
i got the same solution hahaha
what about the '0' edge-case bruh?
Well, i didn't think this shit so well. Good job for you.
Lmao. Hundreds are the worst. I like your math-y way of handling them.
I had to abuse getters to make it a one liner...
Correct syntax would be this.valueOf = () => value.
this.valueOf = () => value
thanks! i'll go try some 7 kyu problems.
Please start using spoiler flag when discussing solutions. Otherwise anyone who hasn't solved the kata can see your post in the homepage.
This is the second comment that claims O(n^2). Is linear time complexity really that difficult to recognize? You should definitely have a firm grasp of time complexity before criticizing people about it.
This is about O(2n) and O(n) amortized.