{"ScriptPreparationCode":"function randomString() {\r\n return Math.random().toString(36);\r\n}\r\n\r\nconst a = [];\r\nconst LEN = 100;\r\nfor (let i = 0; i \u003C LEN; i\u002B\u002B) {\r\n a.push(randomString());\r\n}\r\nconst b = new Set(a);\r\n\r\nfunction binarySearch(sortedArr, target) {\r\n let left = 0, right = sortedArr.length - 1;\r\n while (left \u003C= right) {\r\n const mid = (left \u002B right) \u003E\u003E 1;\r\n if (sortedArr[mid] === target) return mid;\r\n if (sortedArr[mid] \u003C target) left = mid \u002B 1;\r\n else right = mid - 1;\r\n }\r\n return -1;\r\n}\r\n\r\nconst lookups = [];\r\nfor (let i = 0; i \u003C LEN; i\u002B\u002B) {\r\n lookups.push(a[i]);\r\n lookups.push(randomString());\r\n}\r\n","TestCases":[{"Name":"array","Code":"const pick = lookups[Math.floor(Math.random() * lookups.length)];\r\nbinarySearch(a, pick) \u003E= 0;","IsDeferred":false},{"Name":"set","Code":"const pick = lookups[Math.floor(Math.random() * lookups.length)];\r\nb.has(pick);","IsDeferred":false}]}