Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    @PatrickSile i'm actually surprised by how many inefficient solutions get voted up, but in this case there's no discussion about your two points.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Hi,

    1. please do use the spoiler flag when you comment talking about elements of the solution (even here: comments are visible from the dashboard for anyone)
    2. about for/while loops, you're wrong: for loops are faster, and range is a generator (python 3), so it doesn't store the whole range of data so it's quite the same on the memory side
    3. may be wrong too: less lines with the exact same algorithm means faster executions (thanks to interpreted languages) / one liners/lists comprehension means (when they are well used) that you can use chained generators. Might often be faster than decomposing the whole thing with the intermediate lists needed to store your intermediate data.

    It's always the same thing. There are tools. they are good tools. Unless you make bad use of them. ;)

    (btw: golfing (=one liners) is all about the sport! ;) )