I need to make sure that a pair of numbers is either (1, 2) or (2, 1). Both x and y are always positive. The code I am using right now:
if ((x == 2 && y == 1) ||
(x == 1 && y == 2)) {
return 1;
}
It looks a little bulky, and I feel like it can be simplified. However, everything I tried resulted in false positives.