多彩编程 多彩编程MZPH · CODE BLOG
ARTICLE DETAIL

文章详情

深耕前端与后端开发技术的一线实战笔记与踩坑复盘。

leetcode 耗时100 1720. Decode XORed Array

leetcode 耗时100 1720. Decode XORed Array Problem: 1720. 解码异或后的数组耗时100%异或运算是可以交换的 a ^ h c则 h a ^ c, 或者 a h ^ cCodeclass Solution { public: vectorint decode(vectorint encoded, int first) { int n encoded.size(); vectorint tr{first}; for(int i 0; i n; i) { tr.push_back(tr.back() ^ encoded[i]); } return tr; } };
返回列表