4 AnswersNew Answer
Clean code is better for maintenance which is usually 99.99% of the code's life :) However, one liners are always good brain teasers to practice: https://code.sololearn.com/c1O0SXDu2Nb0/?ref=app
Clean code is always better. As it is easy to maintain and modify in future time. And it should not happen that you can't recognise your code after 6 months 😂. Clean code is best. Edit: One liner is good from point of view of security. But i think your code don't have and nuclear formula to make it so secure.
@Taran Grover That is correct. One liners aren't necessarily faster than multiple lines for code that uses a compiler or Just in Time (JIT) compiler as these compilers will break the statement down into it's components and perform the necessary calculations, functions, or operations in as optimal a way as it can. In some interpreters a one liner can actually slow down the code due to multiple complex operations being required in a single line instead of highly optimised simple operations being performed across multiple lines. In some instances the simpler code can actually be faster, especially in a loop, since a peep hole optimiser may recognise the repeated operations and optimise them even further. The only way to be sure is to use a profiler on your code.
In many languages the result in terms of execution speed is the same as the JIT compiler or optimizing compiler will optimise everything. So you may as well make it easy to read and maintain.