{"ScriptPreparationCode":null,"TestCases":[{"Name":"half","Code":"const data = new Array(1000).fill(null).map((n, i) =\u003E i);\r\n\r\nconst bisectHalf = (arr, cv) =\u003E {\r\n let step = Math.ceil(arr.length / 2);\r\n let index = step;\r\n while (step \u003E 1) {\r\n if (\r\n arr[step] === cv ||\r\n (cv \u003E arr[index] \u0026\u0026 arr[index \u002B 1] \u0026\u0026 cv \u003C arr[index \u002B 1])\r\n ) {\r\n step = 0;\r\n }\r\n step = Math.ceil(step / 2);\r\n if (cv \u003E arr[index]) {\r\n index \u002B= step;\r\n } else {\r\n index -= step;\r\n }\r\n }\r\n return arr[index];\r\n}\r\n\r\nfor(var i = 0; i \u003C 1000; i\u002B\u002B) {\r\n\tbisectHalf(data, i);\r\n}","IsDeferred":false},{"Name":"some","Code":"const data = new Array(1000).fill(null).map((n, i) =\u003E i);\r\n\r\nconst bisectSome = (arr, cv) =\u003E {\r\n let index = -1;\r\n arr.some((el, i) =\u003E {\r\n if (el \u003C cv) {\r\n return false;\r\n } else {\r\n index = i - 1;\r\n return true;\r\n }\r\n });\r\n return arr[index];\r\n};\r\n\r\nfor(var i = 0; i \u003C 1000; i\u002B\u002B) {\r\n\tbisectSome(data, i);\r\n}","IsDeferred":false}]}