Ad
  • Default User Avatar

    In case you get stuck a good check is to write out the input given - in this case "console.log(values, n)". Build your own test cases based on this and it will often help you on :)

  • Custom User Avatar

    I get the same error message "Test Failed: maximumSum with n>values.length not working as expected" but I pass the test you offered (Test.assertEquals(minimumSum(new Array(5, 4, 3, 2, -11), 8), maximumSum(new Array(5, 4, 3, 2, -11), 8));) ... No idea what to do.

  • Custom User Avatar

    I'm not sure what you mean by "treat as numbers arrays"?

  • Custom User Avatar

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

  • Custom User Avatar

    Sure thing. Thanks for the feedback.

  • Default User Avatar

    Hey there,

    thanks for this nice kata.

    Is it possible that there is test case missing in your test suite that checks whether isAN(0) returns true?
    I am asking because I was able to produce a solution that passed your suite but returned false in that case.

    Cheers

  • Default User Avatar

    Hey jmusto,

    thanks for your answer. You are right, I missed that instruction. I got it to work now :)

    If you don't mind I would like to suggest you to put the instruction somewhat clearer by saying "if n is larger than values.length, simply include all values to the sum"

  • Default User Avatar

    Hi Chris!

    Sorry it took me a while to answer - and actually sorry also for the bit misleading error message. Try this in your test suite, and see what happens:

    Test.assertEquals(minimumSum(new Array(5, 4, 3, 2, -11), 8), maximumSum(new Array(5, 4, 3, 2, -11), 8));
    

    The point you had missed is the last bullet point in the instructions:

    • if n is larger than values.length, simply include values.length integers to the sum

    But now that this came up, I think I'll edit the test suite a bit, to include a separate test for this.

  • Default User Avatar

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