Day 7: Bridge Repair

Megathread guidelines

  • Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
  • You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL

FAQ

  • iAvicenna@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    If you havent already done so, doing it in the form of binary search, the code completes in the blink of an eye (though on a high end cpu 11th Gen Intel® Core™ i7-11800H @ 2.30GHz). posted the code below

    • stevenviola@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      Thanks! yup, I figured there would be a way. You’re right, much faster, on my machine with your code, this is the speed:

      $ time python3 day7.py 
      4555081946288
      227921760109726
      
      real    0m0.171s
      

      I’ll have to take a look to understand how that works to be better.