{"ScriptPreparationCode":null,"TestCases":[{"Name":"Theirs","Code":"const L = {\u00272\u0027:\u0022abc\u0022,\u00273\u0027:\u0022def\u0022,\u00274\u0027:\u0022ghi\u0022,\u00275\u0027:\u0022jkl\u0022,\r\n \u00276\u0027:\u0022mno\u0022,\u00277\u0027:\u0022pqrs\u0022,\u00278\u0027:\u0022tuv\u0022,\u00279\u0027:\u0022wxyz\u0022}\r\n\r\nvar letterCombinations = function(D) {\r\n let len = D.length, ans = []\r\n if (!len) return []\r\n const dfs = (pos, str) =\u003E {\r\n if (pos === len) ans.push(str)\r\n else {\r\n let letters = L[D[pos]]\r\n for (let i = 0; i \u003C letters.length; i\u002B\u002B)\r\n dfs(pos\u002B1,str\u002Bletters[i])\r\n }\r\n }\r\n dfs(0,\u0022\u0022)\r\n return ans\r\n};","IsDeferred":false},{"Name":"Mine","Code":"const phonePad = {\r\n 0: [\u0027\u0027],\r\n 1: [\u0027\u0027],\r\n 2: [\u0027a\u0027, \u0027b\u0027, \u0027c\u0027],\r\n 3: [\u0027d\u0027, \u0027e\u0027, \u0027f\u0027],\r\n 4: [\u0027g\u0027, \u0027h\u0027, \u0027i\u0027],\r\n 5: [\u0027j\u0027, \u0027k\u0027, \u0027l\u0027],\r\n 6: [\u0027m\u0027, \u0027n\u0027, \u0027o\u0027],\r\n 7: [\u0027p\u0027, \u0027q\u0027, \u0027r\u0027, \u0027s\u0027],\r\n 8: [\u0027t\u0027, \u0027u\u0027, \u0027v\u0027],\r\n 9: [\u0027w\u0027, \u0027x\u0027, \u0027y\u0027, \u0027z\u0027]\r\n};\r\n\r\nvar letterCombinations = function(...nums) {\r\n const first = nums.shift();\r\n const options = nums.reduce((acc, cur) =\u003E {\r\n let strings = [];\r\n for (const str of acc) {\r\n for (const letter of phonePad[cur]) {\r\n const s = \u0060${str}${letter}\u0060;\r\n strings.push(s);\r\n }\r\n }\r\n \r\n return strings;\r\n }, phonePad[first]);\r\n return options;\r\n}","IsDeferred":false}]}