I am trying to divide a matrix into square regions of specified dimensions (k) starting from the upper left corner and then calculate the sum of the maximum value in each region. Here is my progress so far.
arr = [
[ 0, 8, 1, 1, 10, 6 ],
[ 6, 8, 7, 0, 3, 9],
[ 0, 7, 6, 8, 6, 5],
[ 4, 0, 2, 7, 2, 0],
[ 4, 4, 5, 7, 5, 1]
], l = console.log, j = JSON.stringify
result = [0, 3].map(i => arr.map(a => a.slice(i, i+3))) // mapping over indexes to split by for segmenting
l(j(result ))
I am not very experienced with javascript but I am eager to learn. Any assistance would be greatly appreciated.