LeetCode
Permutations
Click
here
for an explanation.