Recursion & DP Target: 15s
Combination backtracking selects k items from n. Avoids duplicates by advancing the start index.
def bt(start, cur):
if len(cur) == k:
res.append(cur[:])
return
for i in range(start, n):
cur.append(a[i])
bt(i + 1, cur)
cur.pop()
bt(0, [])
Type it from memory. Go.