Skip to content

Tag: permutation

Duplicating each character for all permutations of a string

This is a slightly odd/unique request. I am trying to achieve a result where e.g “yes” becomes, “yyes”, “yees”, “yess”, “yyees”, “yyess”, “yyeess”. I have looked at this: Find all lowercase and uppercase combinations of a string in Javascript which completes it for capitalisation, however my understanding is prohibiting me from manipulating this into character duplication (if this method is