WHY IS THIS?

https://www.codechef.com/viewsolution/36988728

https://www.codechef.com/viewsolution/36970005

Why is this happening? Any LOGIC behind it?

Its all about precedence. Read the editorial

3 Likes

@anon48121329, In the first code, it is written a[i] & a[j] == a[i] which is not correct as & operator prefers reading == first. So you need to do this (a[i]&a[j]) == a[i], which will result into AC :slight_smile:

6 Likes

Thanks for info mate

1 Like