Ad
  • Custom User Avatar

    Op solved it, closing

  • Custom User Avatar

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

  • Custom User Avatar

    You see how m is defined as a long in the arguments instead of int?.
    It's because int is too small for some of the bigger factorials.
    Your fac variable overflows and gives incorrect results in those cases. Make it a long and your solution works.

  • Custom User Avatar

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

  • Custom User Avatar

    @CrazyMerlyn: thanks for your help!
    @jamesjohnson92: maybe you could avoid the use of factorial.

  • Custom User Avatar

    It is failing because you keep appending to the same factoial list.
    When you check your code separately, you probably just use the function once.
    But when you use the function again(like repeated tests), it appends two more 1s in the list for each call.
    This ruins your list, and by extension, your code.

    If you plan on calling the generatelist again and again, it should create a new list and return it.
    On the other hand, if you want a global list you should either fill it only once, or make sure you don't make repetitions.

  • Custom User Avatar

    I tried with all the test case given in Test case section ,and i cross checked with the expected results too . i have no idea why it is failing.

  • Custom User Avatar

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

  • Custom User Avatar

    Based on that Test, I assume you are using Python or Ruby.
    I tried both and it seems to be working for me.

    Could you post your solution(mark it as spoiler)?

  • Custom User Avatar

    "-1 should equal 3"
    What does the above statement mean ?

    For the test case Test.assert_equals(checkchoose(35, 7), 3) I get result 3 when i run the function checkchoose(35, 7) in my pc . I dono what result it is returning in this!!. ?