Filpping bits in binary number
问题 Can anyone provide a clear logic for the below problem. I am stuck with confusion. An n bit number is given as input and OP(j) and OP(k) are applied on it one after the other. Objective is to specify how many bits will remain the same after applying these two operations. OP(i) implies flipping of each ith bit. i > 0 回答1: Based on your description, the operation OP(i) will change every 'i'th bit, so it changes a total of floor(n / i) bits. Chaining the operation makes things tricky. If the