Question d’entretien chez ByteDance

Permutation question from leetcode (BackTracking)