15
You're given a n-by-m matrix of integers, where n,m > 3. Your task is to find the 3-by-3 sub-matrix that has the lowest mean, and output this value.
Rules and clarifications:
- The integers will be non-negative
- Optional input and output format
- The output must be accurate up to at least 2 decimal poins (if it's non-integer)
- The submatrices can be made up of arbitrary columns and rows
Test cases:
1 0 4 0 1 0
1 0 4 0 1 0
4 3 4 3 4 3
1 0 4 0 1 0
Minimum mean: 0 (We have chosen columns 2,4,6 and rows 1,2,4 (1-indexed)
-----------------------------
4 8 9 7
5 10 1 5
8 5 2 4
8 3 5 10
6 6 3 4
Minimum mean: 4.2222
-----------------------------
1 0 0 0 0
0 2 0 0 0
0 0 3 0 0
0 0 0 4 0
0 0 0 0 5
Minimum mean: 0.11111
-----------------------------
371 565 361 625 879 504 113 104
943 544 157 799 726 832 228 405
743 114 171 506 943 181 823 454
503 410 333 735 554 227 423 662
629 439 191 707 52 751 506 924
Minimum mean: 309.56
What makes this different from the first version of this challenge? – user41805 – 2017-02-06T14:17:33.903
2@KritixiLithos It uses the more general definition of "submatrix" where a submatrix is any matrix you can obtain from deleting any number of rows and columns from the original (so the remaining rows/columns don't have to be adjacent). – Martin Ender – 2017-02-06T14:20:38.197