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
Open every published interview problem, solution, scene, and memory room free, with no account.