leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1720.cpp (327B)


      1 class Solution {
      2   public:
      3     vector<int> decode(const vector<int> &encoded, int first) const {
      4         const int n = size(encoded);
      5         vector<int> res(n + 1);
      6 
      7         res[0] = first;
      8         for (int i = 0; i < size(encoded); i++) {
      9             res[i + 1] = encoded[i] ^ res[i];
     10         }
     11 
     12         return res;
     13     }
     14 };