Check out example codes for "count no. of ways to partition in k subsets". It will help you in understanding the concepts better.

Code Example 1

```
Input: n = 3, k = 2
Output: 3
Explanation: Let the set be {1, 2, 3}, we can partition
it into 2 subsets in following ways
{{1,2}, {3}}, {{1}, {2,3}}, {{1,3}, {2}}
Input: n = 3, k = 1
Output: 1
Explanation: There is only one way {{1, 2, 3}}
```

Learn ReactJs, React Native from akashmittal.com