{"ScriptPreparationCode":"function getCasePermutationsString(S) {\r\n let result = [];\r\n getCasePermutationsStringRecursive(S, 0, \u0027\u0027, result);\r\n return result;\r\n}\r\n\r\nfunction getCasePermutationsStringRecursive(S, idx, substr, result) {\r\n\tif (idx === S.length) {\r\n\t\tresult.push(substr);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst char = S[idx];\r\n\tconst nextIdx = idx \u002B 1;\r\n\r\n\tif (char \u003E= \u00270\u0027 \u0026\u0026 char \u003C= \u00279\u0027) {\r\n\t\tgetCasePermutationsStringRecursive(S, nextIdx, substr \u002B char, result);\r\n\t\treturn;\r\n\t}\r\n\tgetCasePermutationsStringRecursive(S, nextIdx, substr \u002B char.toLowerCase(), result);\r\n\tgetCasePermutationsStringRecursive(S, nextIdx, substr \u002B char.toUpperCase(), result);\r\n\r\n\treturn result;\r\n}\r\n\r\nfunction getCasePermutationsArr(S) {\r\n let result = [];\r\n let subStrArray = Array(S.length);\r\n getCasePermutationsArrRecursive(S, 0, subStrArray, result);\r\n return result;\r\n}\r\n\r\nfunction getCasePermutationsArrRecursive(S, idx, subStrArr, result) {\r\n\tif (idx === S.length) {\r\n\t\tresult.push(subStrArr.join(\u0027\u0027));\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst char = S[idx];\r\n\tconst nextIdx = idx \u002B 1;\r\n\r\n\tif (char \u003E= \u00270\u0027 \u0026\u0026 char \u003C= \u00279\u0027) {\r\n\t\tsubStrArr[idx] = char;\r\n\t\tgetCasePermutationsArrRecursive(S, nextIdx, subStrArr, result);\r\n\t\treturn;\r\n\t}\r\n\tsubStrArr[idx] = char.toLowerCase();\r\n\tgetCasePermutationsArrRecursive(S, nextIdx, subStrArr, result);\r\n\t\r\n\tsubStrArr[idx] = char.toUpperCase();\r\n\tgetCasePermutationsArrRecursive(S, nextIdx, subStrArr, result);\r\n}","TestCases":[{"Name":"Array version","Code":"getCasePermutationsArr(\u0022a1b2c3d4e5f6g7h8i9j0\u0022)","IsDeferred":false},{"Name":"String version","Code":"getCasePermutationsString(\u0022a1b2c3d4e5f6g7h8i9j0\u0022)","IsDeferred":false}]}