AT&T Interview Question

Permutation leetcode Hard type question