You are viewing a single comment's thread. Return to all comments →
There are ways to make code even shorter but this is far less readable than the above one, without any reduction in complexity since constants dont count. This is really short problem but 'readability' is really important factor in designing large softwares and shouldnt be ignored like this.
Can't agree more about readability in real projects. I just wanted to add more challenge for myself for this particular problem.