{"ScriptPreparationCode":"var array = [];\r\narray.length = 10000;\r\narray.fill(undefined);\r\narray = array.map(() =\u003E Math.floor(Math.random() * array.length));","TestCases":[{"Name":"Set With For Loop","Code":"const set = new Set(array);\r\n\r\nfunction findSet() {\r\n for (let i = 0; i \u003C array.length; i\u002B\u002B) \r\n if (!set.has(i)) return i;\r\n\r\n return -1;\r\n}\r\n\r\nfindSet();","IsDeferred":false},{"Name":"Sort With For Loop","Code":"const sortedArray = array.slice().sort((a, b) =\u003E a - b);\r\n\r\nfunction findSort() {\r\n\tfor (let i = 0; i \u003C array.length; i\u002B\u002B)\r\n if (!sortedArray.includes(i)) return i;\r\n \r\n return -1;\r\n}\r\n\r\nfindSort();","IsDeferred":false},{"Name":"Sort With Reduce","Code":"const sortedReduceArray = array.slice().sort((a, b) =\u003E a - b);\r\n\r\nfunction findReduce() {\r\n\treturn sortedReduceArray.reduce((acc, current) =\u003E (Math.abs(current - acc) \u003E 1 ? Math.min : Math.max)(current, acc), 0) \u002B 1;\r\n}\r\n\r\nfindReduce();","IsDeferred":false}]}