(Use the bookmarklet on this post to see the code with APL font and syntax highlighting.)
Explanation: Two possible answers are the sum of two lower values, and half of the entire sum (floored). We need to take the lower of the two.
(⌊2÷⍨+/)⌊(+/-⌈/) ⍝ Input: an array of 3 numbers
⌊ ⍝ Take minimum of two sides...
⍝ Choice 1:
+/ ⍝ Sum (reduction / by addition +)
- ⍝ Minus
⌈/ ⍝ Max (reduction / by max-of-two ⌈)
⍝ Choice 2:
+/ ⍝ Sum
2÷⍨ ⍝ Divided by 2
⌊ ⍝ Floor of the above
APL (using Dyalog APL):
(Use the bookmarklet on this post to see the code with APL font and syntax highlighting.)
Explanation: Two possible answers are the sum of two lower values, and half of the entire sum (floored). We need to take the lower of the two.
Nice explanation!