AI Features

Print All Permutations of a String

Print all permutations of a given string.

Statement

Given a string, print all possible permutations of the string.

Example

All permutations of string “bad” are:

foo a bad bda abd adb dab dba

Sample input

"bad"

Expected output

["bad", "bda", "abd", "adb", "dab", "dba"] 

Try it yourself

Note: The order in which the permutations are generated or returned does not affect the ...