{"ScriptPreparationCode":"function getCasePermutations(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\tgetCasePermutations(S, nextIdx, substr \u002B char, result);\r\n\t\treturn;\r\n\t}\r\n\tgetCasePermutations(S, nextIdx, substr \u002B char.toLowerCase(), result);\r\n\tgetCasePermutations(S, nextIdx, substr \u002B char.toUpperCase(), result);\r\n\r\n\treturn result;\r\n}\r\n\r\nfunction getCasePermutationsArr(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.push(char);\r\n\t\tgetCasePermutationsArr(S, nextIdx, subStrArr, result);\r\n\t\tsubStrArr.pop();\r\n\t\treturn;\r\n\t}\r\n\tsubStrArr.push(char.toLowerCase());\r\n\tgetCasePermutationsArr(S, nextIdx, subStrArr, result);\r\n\tsubStrArr.pop();\r\n\r\n\tsubStrArr.push(char.toUpperCase());\r\n\tgetCasePermutationsArr(S, nextIdx, subStrArr, result);\r\n\tsubStrArr.pop();\r\n\r\n\treturn result;\r\n}","TestCases":[{"Name":"Array version","Code":"const testString = \u0022a1b2c3d4e5f6g7h8i9j0\u0022;\r\ngetCasePermutationsArr(testString, 0, [], [])","IsDeferred":false},{"Name":"String version","Code":"const testString = \u0022a1b2c3d4e5f6g7h8i9j0\u0022;\r\ngetCasePermutations(testString, 0, \u0027\u0027, [])","IsDeferred":false}]}