{"ScriptPreparationCode":"function randomIntFromInterval(min, max) {\r\n // min and max included\r\n return Math.floor(Math.random() * (max - min \u002B 1) \u002B min);\r\n}\r\nvar rows = [];\r\nlet lasth = 0;\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n lasth \u002B= randomIntFromInterval(16, 50);\r\n rows.push(lasth);\r\n}\r\n\r\nfunction sliceRange(arr, min, max) {\r\n var l = 0,\r\n r = arr.length, res = [];\r\n rough: {\r\n while (l \u003C r) {\r\n var m = ~~(l \u002B (r - l) / 2);\r\n if (arr[m] \u003C min) l = m \u002B 1;\r\n else if (arr[m] \u003E max) r = m;\r\n else break rough;\r\n }\r\n return [];\r\n }\r\n var lr = m,\r\n rl = m;\r\n while (l \u003C lr) {\r\n m = ~~(l \u002B (lr - l) / 2);\r\n if (arr[m] \u003C min) l = m \u002B 1;\r\n else lr = m;\r\n }\r\n while (rl \u003C r) {\r\n m = ~~(rl \u002B (r - rl) / 2);\r\n if (arr[m] \u003E max) r = m;\r\n else rl = m \u002B 1;\r\n }\r\n for (let i = 0; i \u003C 60; i \u002B= 1) {\r\n const rid = i \u002B l;\r\n if (rid \u003C arr.length) res.push(rid);\r\n }\r\n return res;\r\n}\r\nfunction getDatesBetweenRange(dates, min, max) {\r\n var subArray = [];\r\n var value, iCntr;\r\n var start, end;\r\n\r\n var low = 0,\r\n high = dates.length - 1;\r\n while (high - low \u003E 1) {\r\n centre = Math.floor((high \u002B low) / 2);\r\n if (dates[centre] \u003C min) low = centre;\r\n else high = centre;\r\n }\r\n start = low;\r\n high = dates.length - 1;\r\n while (high - low \u003E 1) {\r\n centre = Math.floor((high \u002B low) / 2);\r\n if (dates[centre] \u003E max) high = centre;\r\n else low = centre;\r\n }\r\n end = high;\r\n return [start-1,end\u002B1];\r\n}","TestCases":[{"Name":"sliceRange","Code":"sliceRange(rows, 70000, 70400)","IsDeferred":false},{"Name":"getDatesBetweenRange","Code":"getDatesBetweenRange(rows, 70000, 70400)","IsDeferred":false}]}