Medium · Backtracking
Permutations (string)
Given a string s of distinct lowercase letters, return all of its permutations, i.e. every string that uses each character of s exactly once (s! strings), in any order.
Examples
Example 1
s="abc"Output: 6 perms
Example 2
s="ab"Output: 2 perms
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.