首页 > 编程语言 > 详细

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

时间:2021-05-07 14:36:25      阅读:18      评论:0      收藏:0      [点我收藏+]

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;
    }
}

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

原文:https://www.cnblogs.com/realzhaijiayu/p/14738707.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!