You are probably right, and If I were to make the kata again I would probably do so, however I think changing it now would require quite some changes to the test code, and may invalidate a lot of solutions, so I think its better to leave it as it is.
The 'upper' call on 'decode' method is redundant cause the encoded text, by definition, is always in capital letters. The 'maketrans' function's result would be better to be saved as an object attribute so you don't recalculate the same on every 'encode'/'decode' calls.
Seems like it has been solved by a mathematician <3. Sophisticated solution.
aaaand now i'm super-glad i gave this one a pass.
...except you still have to get the name's length, which is O(n) as well.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Wow, guess I learned something new today! :D
You are probably right, and If I were to make the kata again I would probably do so, however I think changing it now would require quite some changes to the test code, and may invalidate a lot of solutions, so I think its better to leave it as it is.
what a ”multiply one more time“.(doge
This comment is hidden because it contains spoiler information about the solution
If you want to use sorted for shortness at least save 'sorted(arr)' in a variable instead to sort two times the same array.
This is just a list comprehension with string interpolation inside a join call, it is perfectly readable.
This comment is hidden because it contains spoiler information about the solution
The 'upper' call on 'decode' method is redundant cause the encoded text, by definition, is always in capital letters. The 'maketrans' function's result would be better to be saved as an object attribute so you don't recalculate the same on every 'encode'/'decode' calls.
This comment is hidden because it contains spoiler information about the solution
'f' from 'friend' probably.
Loading more items...