From a55f00a0798c50baf1bf6693829e66e9bb71c7d6 Mon Sep 17 00:00:00 2001 From: rubiin Date: Sun, 4 Oct 2020 20:45:18 +0545 Subject: [PATCH] ran standard --- String/CreatePurmutations.js | 54 ++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/String/CreatePurmutations.js b/String/CreatePurmutations.js index 28392ceb2..3df7a6d94 100644 --- a/String/CreatePurmutations.js +++ b/String/CreatePurmutations.js @@ -1,37 +1,31 @@ -function permutations(str){ - +const createPermutations = (str) => { // convert string to array -let arr = str.split(''), + const arr = str.split('') -// get array length - len = arr.length, -// this will hold all the permutations - perms = [], - rest, - picked, - restPerms, - next; - -// if len is zero, return the same string - if (len === 0) - return [str]; -// loop to the length to get all permutations - for (let i=0; i