{"ScriptPreparationCode":"const size = 3000\r\nvar input = new Array(size).fill().map(() =\u003E Math.round(size / 3 * Math.random()))\r\n\r\nfunction getPairCount() {\r\n const pairMap = new Map()\r\n let pairs = 0\r\n input.forEach((number) =\u003E {\r\n if (!pairMap.has(number)) pairMap.set(number, true)\r\n else {\r\n pairMap.delete(number)\r\n pairs\u002B\u002B\r\n }\r\n })\r\n return pairs;\r\n}\r\n\r\nfunction countPairs() {\r\n let nums = [];\r\n let count = [];\r\n input.forEach((num) =\u003E {\r\n if (!nums.includes(num)) {\r\n nums.push(num);\r\n count.push(0);\r\n }\r\n count[nums.indexOf(num)] \u002B= 1;\r\n });\r\n let pairs = 0;\r\n count.forEach((num) =\u003E {\r\n pairs \u002B= Math.floor(num / 2);\r\n })\r\n return pairs;\r\n}\r\n\r\nfunction findPairs() {\r\n const map = new Map()\r\n let pairs = 0\r\n input.forEach(num =\u003E {\r\n if (map.get(num)) {\r\n pairs \u002B= 1\r\n map.set(num, false)\r\n } else map.set(num, true)\r\n })\r\n return pairs\r\n}","TestCases":[{"Name":"Map (delete)","Code":"getPairCount()","IsDeferred":false},{"Name":"Two Arrays","Code":"countPairs()","IsDeferred":false},{"Name":"Map (set false)","Code":"findPairs()","IsDeferred":false}]}