LeetCode 1720. Decode XORed Array Posted on 2021-05-06 Edited on 2024-11-24 In LeetCode 123456789101112class Solution {public: vector<int> decode(vector<int>& encoded, int first) { const int n = encoded.size(); vector<int> ans(n + 1); ans[0] = first; for (int i = 0; i < n; ++i) { ans[i + 1] = ans[i] ^ encoded[i]; } return ans; }};