class Solution { public: vector<int> decode(vector<int>& encoded, int first) { vector<int>v; int n=encoded.size(); v.push_back(first); for(int i=0;i<n;i++) { int x=encoded[i]^v[i]; v.push_back(x); } return v; } };
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter