[Solved] “Little girl and maximum XOR”

[ad_1] If you read about __builtin_clzll in http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html — Built-in Function: int __builtin_clzll (unsigned long long x) Returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined. From https://cs.stackexchange.com/a/29510, The maximum possible XOR of any two integers from an interval [l, r] … Read more

[Solved] Bitwise shift operation choice

[ad_1] The reason it works this way is because C and C++ used << for left shift and >> for right shift long before Java. Those languages have both signed and unsigned types, and for signed types the sign bit was propagated in the right-shift case. Java does not have unsigned types, so they kept … Read more