Given 2 integers, N and k, the task is to find the number of groups of size k, whose elements are positive integers and add up to N.
Two groups are considered distinct if they have a different representation when their elements are sorted in ascending order.
For N = 8 and k = 4, the valid groups are:
The order of elements does not matter. For example, the groups {1, 1, 1, 5}, {1, 1, 5, 1}, {1, 5, 1, 1}, and {5, 1, 1, 1} are all considered the same because their sorted representation is {1, 1, 1, 5}.
Medium