Ad
  • Default User Avatar

    Your's is probably a bit faster without the need to copy the list. I tend to not modify the data I'm given just in case the test cases are written in such a way as to depend on the same data after my function is called (it's bitten me in the past).

  • Default User Avatar

    There's plenty of cleverness on this solution and others, but what I most appreciate about this one are the comments and organization. Enough comments to get a high level overview of what's going on without distracting from the code. Thank you.

  • Default User Avatar

    Concur but I am so thankful to the author. It's one of those gems that, if you put in the work, you'll learn something.

  • Default User Avatar

    The spec says to find a positive integer. return s/n returns a float. Use integer division s//n. Good answer though.