public class Solution
{
public int XorOperation(int n, int start)
{
// 「運算步驟的數量」
var operationCount = n;
// 「起始數值」
var startValue = start;
// 「輸出值」
var output = startValue;
for (int i = 1; i < operationCount; ++i)
{
output ^= startValue + 2 * i;
}
return output;
}
}
https://leetcode.com/problems/xor-operation-in-an-array/
請參考「刷 LeetCode 練習命名」 https://github.com/EngTW/English-for-Programmers/issues/69 😊