{"ScriptPreparationCode":"function intersect(arrays) {\r\n const response = arrays.length === 1 ? [...arrays[0]] : [];\r\n if (arrays.length \u003E 1) {\r\n const nOthers = arrays.length - 1;\r\n let nShortest = arrays[0].length;\r\n let shortest = 0;\r\n for (let i = 0; i \u003C= nOthers; i\u002B\u002B) {\r\n const n = arrays[i].length;\r\n if (n \u003C nShortest) {\r\n shortest = i;\r\n nShortest = n;\r\n }\r\n }\r\n let len;\r\n const obj = {};\r\n for (let i = 0; i \u003C= nOthers; i\u002B\u002B) {\r\n const n = i === shortest ? 0 : i || shortest; //Read the shortest array first. Read the first array instead of the shortest\r\n len = arrays[n].length;\r\n for (let j = 0; j \u003C len; j\u002B\u002B) {\r\n const item = arrays[n][j];\r\n if (obj[item] === i - 1) {\r\n if (i === nOthers) {\r\n response[response.length] = item;\r\n obj[item] = 0;\r\n }\r\n else {\r\n obj[item] = i;\r\n }\r\n }\r\n else if (i === 0) {\r\n obj[item] = 0;\r\n }\r\n }\r\n }\r\n }\r\n return response;\r\n}\r\nn1 = [24005, 18321, 478, 1113369];\r\nn2 = [];\r\ns1 = n1.map(i =\u003E \u0060${i}\u0060);\r\ns2 = [];\r\nfor (let i = 0; i \u003C 100000; i\u002B\u002B) {\r\n n2.push(i);\r\n s2.push(\u0060${i}\u0060);\r\n}\r\n\t\r\n\t","TestCases":[{"Name":"number","Code":"intersect([n1, n2])","IsDeferred":false},{"Name":"string","Code":"intersect([s1, s2])","IsDeferred":false}]}