Company: HiLabs_SDE
Difficulty: medium
The coin problem Problem Description Given N coins whose amount ranges from 0 to N-1 respectively. Your friend wants to take K coins out of your coins. You can only give the coins if the set of K coins is useful. A set of coins is useful if the sum of the coins is divisible by a given integer M. Find the number of ways in which your friend can get K coins. Since the answer can be large, print the answer modulo 10 9 + 7. Complete the solve function provided in the editor. This function takes the following 3 parameters and returns the answer: n: Represents the number of coins k: Represents the number of coins your friend wants m: Represents the integer value Examples Example 1: Input: 4 2 2 Output: 2 Explanation: Given the input 4 2 2 , we have: N = 4 K = 2 M = 2 Approach: There are 2 ways (assuming coins are 1-indexed: {1, 2, 3, 4} as per example): 1 st Set: {1, 3} with sum 1+3=4 having 4%2=0 2 nd Set: {2, 4} with sum 2+4=6 having 6%2=0 Constraints 1 ≤ N ≤ 10 3 1 ≤ K ≤ 10 2