Ad
  • Custom User Avatar

    In the other kata (http://www.codewars.com/kata/5508249a98b3234f420000fb) it is said:

    if possible the message will be evenly split between the five runners; if not possible, parts 1, 2, 3, 4 will be longer
    and part 5 shorter. The fifth part can have length equal to the other ones or shorter. If there are many options of how > to split, choose the option where the fifth part has the longest length.

    For example, if the coded message has a length of 17 the five parts will have lengths of 4, 4, 4, 4, 1. The parts 1, 2, > 3, 4 are evenly split and the last part of length 1 is shorter. If the length is 16 the parts will be 4, 4, 4, 4, 0.
    Parts 1, 2, 3, 4 are evenly split and the fifth runner will stay at home.

    I hope this helps you. Tell me if this works!

  • Custom User Avatar

    Unless you would want the distribution of 257 letters between 5 messengers to be 52, 52, 52, 52, 49? I suppose it makes sense in the problem description, but it's definitely not optimized.

    Imagine 320 messengers carrying 2568 letters. My distribution would be 9 for the first 8 messengers and 8 for the rest. The distribution I described above won't work at all.

  • Custom User Avatar

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

  • Custom User Avatar

    Reload the page, I have spoiler flagged my answer but you must able to see both!

  • Custom User Avatar

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