Sort by

recency

|

63 Discussions

|

  • + 1 comment

    In some languages this does not submit correctly.

    In Node.js, paste:

    ws.write(result + "\n")

    at the end of function main's for loop.

    Cheers!

  • + 0 comments

    The Python template is missing the code to write the result to stdout. You can add the following lines to do so:

            fptr.write(str(result))
            fptr.write('\n')
    
  • + 0 comments

    This code efficiently calculates the number of ways Jim can buy candies, a common problem in computer science courses. I am getting assignment help from it.

  • + 0 comments

    The framework for C doesn't output any results. In main(), right underneath

        int result = solve(n, k);
    

    add the following line:

        fprintf(fptr, "%d\n", result);
    
  • + 0 comments

    Python 3 solution:

    return math.comb(n + k - 1, k) % 10 ** 9
    

    Explanation:

    See section Number of combinations with repetition here: https://en.wikipedia.org/wiki/Combination