{"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 const index = Math.round(arr.length / 2);\r\n for (let chunk = arr.length / 2; chunk \u003E 1; chunk /= 2) {\r\n if(arr[index] \u003C= cv \u0026\u0026 arr[index \u002B 1] \u0026\u0026 arr[index \u002B 1] \u003E cv) {\r\n chunk = 0;\r\n return;\r\n }\r\n }\r\n return index;\r\n}\r\n\r\nbisectHalf(data, 100);\r\nbisectHalf(data, 200);\r\nbisectHalf(data, 300);\r\nbisectHalf(data, 400);\r\nbisectHalf(data, 500);\r\nbisectHalf(data, 50);\r\nbisectHalf(data, 950);","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\nbisectSome(data, 100);\r\nbisectSome(data, 200);\r\nbisectSome(data, 300);\r\nbisectSome(data, 400);\r\nbisectSome(data, 500);\r\nbisectSome(data, 50);\r\nbisectSome(data, 950);","IsDeferred":false}]}