Ad
  • Custom User Avatar

    Ruby:

    • No fixed tests

    • function name should use snake_case

  • Custom User Avatar
  • Custom User Avatar
    • Node 12 should be enabled (Refer this and this for more info)

    • Python new test framework should be used (Refer this & this for more detail)

    • Ruby 3.0 should be enabled (Refer this & this for more detail)

  • Custom User Avatar

    From the Example Tests:

    Test.assertEquals(numCombo([2, 0, 0, 0, 1], 2), 1)
    Test.assertEquals(numCombo([0, 0, 0, 0, 1], 1), 4)
    

    I do not understand this. Both arrays have length 5. So I am to make combinations of length 4. The sum of the elements of those combinations has to be 2 resp 1.

    It would seem I have to answer 1 possible combination in the first case, so [2,0,0,0] is apparently counted as the same as [0,2,0,0].

    It would seem I have to answer 4 possible permutations (not combinations!) in the second case, because [0,0,0,1] is apparently counted as different from [0,0,1,0].

    What am I misunderstanding?

  • Custom User Avatar

    Good job on the fixed and random tests, keep up the good work :) However, I'm not sure why you had to limit the length of the input array to just 5 as your Description states that "The combination length will be limited to all combinations which are exactly one less than the length of the array" which made me assume that my solution should be able to handle arrays of any length. I would suggest that you edit the random (and fixed) tests to include assertions that test for input arrays of varying length (and preferably a longer average length than 5). Currently, most (not all) of the random tests simply expect 0 as the range of random values entered into each array is too large compared to the actual length of the array.