{"ScriptPreparationCode":"//-- must be var to scope globally\r\nvar data = [2, 5, 4, 6, 3, 7, 8, 4, 6, 1, 6, 2, 8, 8, 7, 6];\r\nvar blockLength = 3;","TestCases":[{"Name":"Lodash Map","Code":"const numBlocks = data.length - blockLength \u002B 1;\r\n\r\nconst minPerBlock = _.range(0, numBlocks).map((i) =\u003E\r\n Math.min(...data.slice(i, i \u002B blockLength))\r\n);\r\n\r\nconst maxOfMins = Math.max(...minPerBlock);\r\n\r\nconsole.log(minPerBlock);\r\nconsole.log(maxOfMins);","IsDeferred":false},{"Name":"For Loop to Block Array","Code":"const numBlocks = data.length - blockLength \u002B 1;\r\nconst minPerBlock = [];\r\n\r\nfor (let i = 0; i \u003C numBlocks; \u002B\u002Bi) {\r\n const block = data.slice(i, i \u002B blockLength);\r\n minPerBlock.push(Math.min(...block));\r\n}\r\n\r\nconst maxOfMins = Math.max(...minPerBlock);\r\n\r\nconsole.log( minPerBlock )\r\nconsole.log( maxOfMins )","IsDeferred":false},{"Name":"Maps","Code":"const minPerBlock = [...data].map((v, idx, self) =\u003E {\r\n return self.length \u003E idx\u002B(blockLength-1) ? self.slice(idx, idx \u002B blockLength) : [0];\r\n}).map((group)=\u003E Math.min(...group) );\r\nconst maxOfMins = Math.max(...minPerBlock);\r\n\r\nconsole.log( minPerBlock )\r\nconsole.log( maxOfMins )","IsDeferred":false}]}