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
Core interview problems are free with a full runner and lessons; Pro opens the complete library.