Generate combinations and permutations | Bytedance Interview Question