{"ScriptPreparationCode":"const ALPHABET = \u0027abcdefghijklmnopqrstuvwxyz\u0027\r\nconst makeSet = () =\u003E {\r\n const count = Math.round(Math.min(Math.random() * 4 \u002B 1, ALPHABET.length))\r\n let out = []\r\n for (let i = 0; i \u003C count; i\u002B\u002B) {\r\n let char\r\n do\r\n char = ALPHABET[Math.floor(Math.random() * ALPHABET.length)]\r\n while (out.includes(char))\r\n out.push(char)\r\n }\r\n return out.sort().join(\u0027\u0027)\r\n}\r\n\r\nconst shuffleSet = (set) =\u003E {\r\n let out = \u0027 \u0027.repeat(Math.round(Math.random() * (set.length * 2) \u002B 3))\r\n for (const char of set) {\r\n const count = Math.round(Math.random() * 3 \u002B 1)\r\n for (let j = 0; j \u003C count; j\u002B\u002B) {\r\n const idx = Math.floor(Math.random() * out.length)\r\n out = out.slice(0, idx) \u002B char \u002B out.slice(idx)\r\n }\r\n }\r\n\r\n return out\r\n}\r\n\r\nconst makeCase = () =\u003E {\r\n const filler = makeSet()\r\n let answer\r\n do {\r\n answer = makeSet()\r\n } while (answer === filler)\r\n answer = shuffleSet(answer)\r\n const count = Math.random() * 6 \u002B 4\r\n\r\n const input = []\r\n for (let i = 0; i \u003C count; i\u002B\u002B)\r\n input.push(shuffleSet(filler))\r\n input.splice(Math.floor(Math.random() * input.length), 0, answer)\r\n\r\n return { input, answer }\r\n}\r\n\r\nvar cases = [\r\n makeCase(),\r\n makeCase(),\r\n makeCase(),\r\n]","TestCases":[{"Name":"Solution next day","Code":"function findUniq(strings) {\r\n const uniq = {}\r\n for (let i = 0; i \u003C strings.length; i\u002B\u002B) {\r\n const l = new Set(strings[i].replace(/\\s\u002B/g, \u0027\u0027).toLowerCase()).size\r\n uniq[l] = !(l in uniq) ? strings[i] : null\r\n }\r\n return Object.values(uniq).find(v =\u003E v)\r\n}\r\n\r\nfor (const { input, result } of cases)\r\n console.assert(findUniq(input) === result)","IsDeferred":false},{"Name":"Solution on interview","Code":"function findUniq(strings) {\r\n const s1 = strings.map((s) =\u003E s.toLowerCase().replaceAll(/\\s/g, \u0027\u0027))\r\n const s2 = s1.map((s) =\u003E [...new Set(s)].sort().join(\u0027\u0027))\r\n let out = []\r\n for (let i = 0; i \u003C s2.length; i\u002B\u002B) {\r\n const elm = s2[i]\r\n if (out.some((idx) =\u003E s2[idx] === elm))\r\n out = out.filter((idx) =\u003E s2[idx] !== elm)\r\n else\r\n out.push(i)\r\n }\r\n return strings[out[0]]\r\n}\r\n\r\nfor (const { input, result } of cases)\r\n console.assert(findUniq(input) === result)","IsDeferred":false}]}