ByteDance interview question

1, 2 sums 2, permutations and some basic cs knowledge.