News for hackers. Stuff that matters.
Re:What's Wrong with Tech Hiring by cousin_it on Thursday September 16, 2021 @01:15PM (#28554448)
I like this question! Let's assume a<b, x<y, and intervals are open.

Okay: max(a,x)<min(b,y), using three comparisons.

Better: (a<x)?(b>x):(a<y), using two.

Best: (a<y)&&(b>x), using either one or two.

Re:What's Wrong with Tech Hiring by pklausler on Thursday September 16, 2021 @01:39PM (#28554695)
Those are all fine to me, and I'll follow up with a "how do you know that's right?" if needed. Looping over all valid values in one interval, testing for membership in the other, is kind of a red flag. A predicate that is incorrect and not caught by testing might be a very bad sign.