Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Very nice solution and good for learning!

  • Custom User Avatar

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

  • Custom User Avatar

    It seems the tests do not test all requirements.

    For example:
    apples: 9 capacity: 20 max_left: 2

    Should yield 7 (according to tests)

    e.g.

    buckets: 1 apples per bucket: 9 rest: 0
    buckets: 2 apples per bucket: 4 rest: 1
    buckets: 3 apples per bucket: 3 rest: 0
    buckets: 4 apples per bucket: 2 rest: 1
    buckets: 7 apples per bucket: 1 rest: 2
    buckets: 8 apples per bucket: 1 rest: 1
    buckets: 9 apples per bucket: 1 rest: 0

    However this fails the criteria:
    "if each box contains x apples, the number of left out apples should be less than x."

    for:
    buckets: 7 apples per bucket: 1 rest: 2 ( 2 > 1 )

  • Custom User Avatar

    oprypin inspired, that solution voted for Best Practises +1
    Only needs to left strip a leading '-' since we won't have a trailing '-'