Easy · Backtracking
All Length-K Strings From a Character Set
Given a string chars of distinct characters and an integer k, return every string of length k made from those characters, with repetition allowed, in any order.
Examples
Example 1
"ab", k=2Output: 4 strings
Example 2
"abc", k=2Output: 9 strings
Rebuild it in the studio
Core interview problems are free with a full runner and lessons; Pro opens the complete library.