Inefficient, but super clever!
Good grief. Mine is awfully clumsy by comparison... Very nice.
By details of this kata we must sum up the CUBES of digits.
I think you need to fix it here "sum += Character.getNumericValue(num);"
However, it is great solution
This comment is hidden because it contains spoiler information about the solution
I dont understand this solution. Can you explain it to me sir? I would like to learn that
I really like this solution. My one thought is if there are potentially a lot of duplicates, would it make sense to check if words[n] exists before setting calling num2word again?
While it's true that this could be approximately twice as fast, the complexity is still the same (constant factors are ignored).
yeah, great solution.
Well thought regex. Simply loved it!
Removing the last $ would leak matches such as 255.255.255.255.123456789.
However, removing the second last $ would still work.
The complexity of this is O(2nlog(n)) because each iteration sorts word. It could be twice as fast (O(nlog(n))) if the sorted word were saved to a variable.
this solution uses the substring methond very well!
Cause StringBuffer is thread-safe and used only if you have multi-threading programm and need synchronisation. So, it's work slower that StringBuilder. In this case there are no reasons to choose StringBuffer, cause we have just one thread.
I like this one
PHP test with input expression: 123.45*(678.90 / (-2.5+ 11.5)-(80 -19) *33.25) / 20 + 11 expected not correct value. Correct value should be -12042.760875
I got message: Failed asserting that -12042.760875000207 matches expected -12042.760875.