17201 [LeetCode] 1720 Decode XORred Array Solution Use principle : A ^ B = C -> A ^ C = B class Solution { public: vector decode(vector& encoded, int first) { vector res; res.push_back(first); for (int i = 0; i != encoded.size(); ++i) { res.push_back(res.back() ^ encoded[i]); } return res; } }; 2023. 1. 29. 이전 1 다음