C++范围内最大奇数约数的异或查询

C++范围内最大奇数约数的异或查询

给定一个包含 N 个整数的数组和 Q 个范围查询。对于每个查询,我们需要返回范围内每个数字的最大奇数除数的异或。

最大奇数除数是可以整除数字 N 的最大奇数,例如 。例如,6 的最大奇数约数是 3。

Input: nums[ ] = { 3, 6, 7, 10 }, query[ ] = { { 0, 2 }, { 1, 3 } } Output: query1: 7 query2: 1 Explanation: greatest odd divisors of nums array are { 3, 3, 7, 5 }. For query 1 we need to find the XOR of indexes 0, 1, and 2 which is 7, and for query2 we need to find XOR of indexes 1, 2, and 3 which is 1.登录后复制