All subsets size k
Medium
Given a set of characters represented by a String, return a list containing all subsets of the characters whose size is K.
Assumptions
There are no duplicate characters in the original set.
​Examples
Set = "abc", K = 2, all the subsets are [“ab”, “ac”, “bc”].
Set = "", K = 0, all the subsets are [""].
Set = "", K = 1, all the subsets are [].
Mistakes Made:
if index == set.length() base case is not addressed, stackoverflow or indexoutofbounds error will occur
DONT INCREMENT K. NO TOUCHE
Remember to clarify edge cases
Last updated
Was this helpful?