Decode XORed Array LeetCode solution in C++

1
class Solution {
2
public:
3
vector<int> decode(vector<int> &encoded, int first) {
4
vector<int> ans{first};
5
for (int x : encoded) ans.push_back(first ^= x);
6
return ans;
7
}
8
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0