Ad
  • Default User Avatar
  • Custom User Avatar

    input a was: 20 , input b was: 9
    Expected: '2 group(s) of 9 & 1 group(s) of 8', instead got: '2 group(s) of 10'

    Test cases are broken. 2*9+8 is 26, which is, as you'd agree, more than 20.

  • Custom User Avatar

    The random tests don't compute:

    input a was: 40 , input b was: 7
    Expected: '5 group(s) of 7 & 1 group(s) of 6', ...
    

    5 * 7 + 6 == 41

    input a was: 43 , input b was: 9
    Expected: '4 group(s) of 9 & 1 group(s) of 8', ...
    

    4 * 9 + 8 == 44

  • Custom User Avatar

    Edge cases are unspecified. groupSizer(7,5) is just impossible and groupSizer(5,2) is ambiguous.

  • Custom User Avatar

    Why stringify everything? An Array of Numbers return value would have been perfectly serviceable. [] might signify an impossible grouping, or you can throw an Error.

    Use appropriate datatypes!

  • Custom User Avatar

    Can't figure this out at the moment. The description seems incomplete or at least hard to understand.

    This is what I get from the description:

    students, groupSize

    • Make groups of size groupSize.
    • If there are left over students that cannot make up another complete group, distribute them evenly according to the following rules:
      • Add at most 1 student to an existing group.
      • Remove at most 1 student from an existing group.
    • Return a string with each size of group written out in the form "count group(s) of size".

    In some tests, there are too few left over for a new group but too many to add only 1 to each existing group.

    How would subtracting from groups help distribute the remaining students into the groups?

    There is nothing saying what order to put the returned group sizes in.


    I'm guessing maybe you actually want for all groups to be (1) as close as possible to each other, and (2) for the average group size to be as close as possible to the specified desired group size. Though it's hard to see what exactly the rules are for when to go with (1) vs (2).

    Also, I'm still not sure about that return formatting question.