Welcome to MindCipher, a social repository of the world's greatest brain teasers, logic puzzles and mental challenges.

Grant Goodman

Likes 0

Grant Goodman must be new here...

Ratings 0

No ratings yet!

Comments 1

No if() Only abs()

Here's an intuitive derivation of the solution:

(a+b)/2 gives you the average, which is directly in between a and b, and it is 1/2 the difference from either a or b. So to get to the larger one, just add the difference of the two divided by two, giving you (a+b)/2 + abs(a-b)/2, or (a+b+abs(a-b))/2

context