Instructions
Write a function called permutations that takes in a string as a parameter and returns an array of all possible permutations of the characters in the string.
Function Signature
/**
* Returns all possible permutations of the characters in a string.
* @param {string} str - The string to permute.
* @returns {string[]} - An array of all possible permutations of the characters in the string.
*/
function permutations(str: string): string[];
Examples
permutations('abc'); // ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
permutations('dog'); // ['dog', 'dgo', 'odg', 'ogd', 'gdo', 'god']
Constraints