其他分享
首页 > 其他分享> > 【每日一题】1486. 数组异或操作

【每日一题】1486. 数组异或操作

作者:互联网

https://leetcode-cn.com/problems/xor-operation-in-an-array/

class Solution {
    public int xorOperation(int n, int start) {
        int res = 0;
        for(int i = 0; i < n; i++){
            res ^= start + i * 2;
        }
        return res;
    }
}

标签:cn,int,res,start,异或,1486,数组
来源: https://www.cnblogs.com/realzhaijiayu/p/14738707.html