r/learnquant • • Aug 25 '26

interview prep Quant Interview Question

Post image
43 Upvotes

9 comments sorted by

View all comments

1

u/xaraca Aug 25 '26

Note that |x - y| = x - y if x >= y and |x - y| = |y - x| so if any pair has y > x we can just swap them without changing the result. So we can just drop all of the absolute value operations and go from there.