# 1.2 All Subsets of Size K

Assumption: No duplicate

Solution:&#x20;

1. Similar to Q1.1, only have to make sure the branches stop when subset size is k and does not go all the way down.&#x20;
2. Stop condition: when subset size reaches k and all letters have been considered.

&#x20; `//base case`

&#x20; `if (sb.length() == k) {`

&#x20;    `res.add(sb.toString());`

&#x20;    `return;`

&#x20;  `}`

&#x20;  `if (index == array.length) {`

&#x20;    `return;`

&#x20;  `}`
