Skip to content
Advertisement

Tag: combinations

How do you generate all 5 letter strings from 3 characters?

Given 3 characters (abc), I want to generate all possible 5-letter strings with them (aaaaa, aaaab, … ccccb, ccccc) This feels like an inefficient way to do this, so is there a more elegant/efficient way to do this? Answer Your nested for loops does imply that code can be refactored either using recursion or as in my example below by

Advertisement