Ad
  • Custom User Avatar

    Thanks for drawing attention to this corner case!

  • Custom User Avatar

    Right, so it counts as the full '2' (as opposed to being only 'worth' 1.

  • Custom User Avatar

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

  • Custom User Avatar

    My code Java throws a divide-by-zero exception in the main test suite for the random big numbers. Careful with the overflow :)

  • Custom User Avatar

    787 is both palindrome and two before 789...

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    I'm sorry, but I can't comprehend the phrase "at least as long as when evenly divided".

    The answer obtained by googling your suggested phrase goes to a stackoverflow question about doing this in python. The two most common approaches there split a list either as

    10 10 10 10 10 10 10 5
    

    which is simply the result of partition a 75-long list into chunks of 10 plus the leftover and has nothing to do with equal splitting,
    or as

    6 5 5 5 5
    

    It's easy to see, that any list can be split into any amount of chunks which differ in length by no more than 1. Here's an example:

    1 -> 1 0 0 0 0
    2 -> 1 1 0 0 0
    3 -> 1 1 1 0 0
    4 -> 1 1 1 1 0
    5 -> 1 1 1 1 1
    6 -> 2 1 1 1 1
    

    Is it a requirement that the first two chunks be equal in length? What about 1 -> 1 0 0 ...?

    Because, honestly, I do not see how 6 -> 2 2 1 1 0 is more desirable. It seems to break the pattern, though it is much more like 11 -> 3 3 3 2 0 (but why not 3 3 2 2 1?).