Ad
  • Custom User Avatar

    Language: Python
    Skill level: Absolute beginner

    Thought I'd come up with a pretty good (by my standards) solution to this one, but when I run it, it times out. No problem, inefficient code is my bet.
    However, by purposely causing it to fail (simply leaving out the final integer to the array/list each time) it's essentially "passing" (or, would be) fairly consistently at around 2000ms, +/- 200ms.

    Now I don't know the specifics of how execution time works, but it doesn't seem right to me that this last digit in each array can be slowing the whole thing down by five times or more... Can it?
    Leaving out the final two integers instead of just the one doesn't seem to make it run any faster (on average, due to random tests), and some of these arrays have thousands of integers in them, so that kinda rules out some kind of exponential error/loop, right?

    I know it's something wildly obvious that I'm missing, but if anybody has the time to explain what I'm doing wrong I'd really appreciate it. I'll post some lightly commentated code below if anybody is interested in helping.