public int greenTicket(int a, int b, int c) { // Use the transitive property of equality // No need to check whether a == c if you check the other 2 cases if (a == b && b == c) { return 20; } // If we have gotten to here, then all 3 numbers are NOT the same, // i.e., at least one of the numbers is different // Hence no need for something like: if (a == b && b != c) else if (a == b || a == c || b == c) { return 10; } // If we have gotten to here, all of the numbers are different. // Hence, no need for the IF statement. else { return 0; // if (a != b && b != c && a != c) } }