Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

2 of 2
added 279 characters in body
Martin Ender
  • 198.2k
  • 67
  • 455
  • 998

Mathematica, (削除) 77 (削除ここまで) 50 bytes

±x_:=x~Subsets~{3}
Min[Mean/@Mean/@±#&/@±#]&

is Mathematica's transposition operator (and is rendered as a superscript T in Mathematica).

This answer first defines a helper operator ± which returns all 3-element subsets of a list, and then evaluates to an unnamed function which uses this operator to solve the problem.

This is done by first computing all 3-element subsets of the matrix's rows. Then for each such subset, we transpose it and compute its 3-element subset of rows. This gives us all possible 3x3 submatrices (although they are transposed). We then compute the mean on all of them and find the overall minimum.

Martin Ender
  • 198.2k
  • 67
  • 455
  • 998

AltStyle によって変換されたページ (->オリジナル) /