[Solved] Tried to solve the “Close Far” exercise [closed]
You basically need to compare a with both b and c (using Math.abs(a-b) and using Math.abs(a-c)) and then check if the other values differ by at least 2. Something like this: public static boolean closeFar(int a, int b, int c) { return ( (Math.abs(a-b) == 1 && (Math.abs(a-c) >= 2 && Math.abs(b-c) >= 2) || … Read more