Count the ways to select K coins whose sum is divisible by M.
Unlock detailed company stats for this questionUpgrade
There are N coins valued 0 to N-1. Calculate the number of ways to select K coins such that their sum is divisible by M. Return the answer modulo 1e9+7. Signature: int solve(int N, int M, int K). Example: input 4 2 2 gives output 2. Constraints: 1 <= N, M, K <= 10^3.
Format · Google L4 online assessment, December 24, 2025.
Community answers
No answers contributed by the community yet.
Related questions
Paths in Matrix Whose Sum Is Divisible by K.Count the subarrays whose median is K.Count the subarrays whose XOR is K.Related courses

Course

Course
Course
