{"ScriptPreparationCode":null,"TestCases":[{"Name":"Map","Code":"const createLists = (arr = []) =\u003E [\r\n ...arr.reduce((map, val) =\u003E {\r\n if (!map.has(val)) {\r\n map.set(val, [val]);\r\n } else {\r\n map.get(val).push(val);\r\n }\r\n return map;\r\n }, new Map()).values()\r\n];\r\nconsole.log(createLists([1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0]));","IsDeferred":false},{"Name":"forEach","Code":"function createLists(arr = []) {\r\n let authors = [];\r\n let list = [];\r\n\r\n arr.forEach(item =\u003E {\r\n let authorIndex = authors.includes(item) ? authors.indexOf(item) : (authors.push(item) - 1);\r\n list[authorIndex] = list[authorIndex] || [];\r\n list[authorIndex].push(item);\r\n });\r\n\r\n return list;\r\n}\r\n\r\nconsole.log(createLists([1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0]));","IsDeferred":false}]}