Skip to main content
added 449 characters in body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221

Pyth, 11 bytes

Seems rather long.

.cF_tSa0+aF 

Test suite

Explanation

Uses xnor's description.

.cF_tSa0+aF Full program. Input: a 2-element list [a,b]. +aF Add |a-b| to the list of inputs. Produces [|a-b|,a,b] a0 Absolute difference with 0 (i.e. absolute value). Vectorizes. tS Sort the list of absolute values and remove the first element. .cF_ Reverse the above and apply nCr to its elements. 

Pyth, 11 bytes

Seems rather long.

.cF_tSa0+aF 

Test suite

Pyth, 11 bytes

Seems rather long.

.cF_tSa0+aF 

Test suite

Explanation

Uses xnor's description.

.cF_tSa0+aF Full program. Input: a 2-element list [a,b]. +aF Add |a-b| to the list of inputs. Produces [|a-b|,a,b] a0 Absolute difference with 0 (i.e. absolute value). Vectorizes. tS Sort the list of absolute values and remove the first element. .cF_ Reverse the above and apply nCr to its elements. 
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221

Pyth, 11 bytes

Seems rather long.

.cF_tSa0+aF 

Test suite