Largest K by K Group in 2D Array
You are given a two dimensional array containing an array of integers and an integer K as arguments. Return the largest sum found by adding together K x K groups of integers in the two dimensional array.
There will always be at least K number of arrays in the two dimensional array and at least K number of integers in each inner array.
Requirements
Example #1
solve([
[100, 150, 0, 0, 350],
[160, 100, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 200, 250, 0],
[0, 0, 300, 200, 0],
], 2)
> 950
- Since K = 2, we want to find the largest sum of numbers in a 2x2 group.
- The groups 100,150 and 160,100 would return only 510.
- The groups 200,250 and 300,200 would return 950, which is our largest sum.