##
Count smaller numbers whose XOR with n produces greater value
February 20, 2017

Given a positive integer n, count numbers x such that 0 < x <n and x^n > n where ^ is bitwise XOR operation. Examples: Input : n = 12 Output : 3 Numbers are 1, 2 and 3 1^12 > 12, 2^12 > 12 and 3^12 > 12 Input : n = 11 Output… Read More »