Optimizing Small Python Code
Michael F. Stemper
michael.stemper at gmail.com
Wed Jun 23 10:22:50 EDT 2021
On 23/06/2021 08.17, Stefan Ram wrote:
> "Avi Gross" <avigross at verizon.net> writes:
>> This can be made a one-liner too! LOL!
>
> print( '1\n 0\n2\n 0\n 1\n3\n 0\n 1\n 2\n4\n 0\n 1\n 2\n 3\n5\n 0\n 1\n 2\n 3\n 4\n6\n 0\n 1\n 2\n 3\n 4\n 5\n' )
Unless I'm figuring ot wrong, you just took it from O(n^2) to
O(1). That deserves a Turing award or something.
--
Michael F. Stemper
You can lead a horse to water, but you can't make him talk like Mr. Ed
by rubbing peanut butter on his gums.
More information about the Python-list
mailing list