WA brackets "()"

This query is related to the recent long challenge’s codecracker question.Can anyone please tell me why CodeChef: Practical coding for everyone solution failed and CodeChef: Practical coding for everyone solution passed even though there is difference in brackets between (I&1)==(K&1) in the twelth line and everything else in the two solutions is the exact same??

COMPRISON(==) operator has high precedence than BITWISE AND(&) check here.

In the WA solution l&1==k&1 it will be calculated l&(1==k)*1.

For the AC solution “()” do the right job for you as they have the high precedence.

Hope you understood the difference.

1 Like