简历:The Google Resume: How to Prepare for a Career and Land a Job at Apple, Microsoft, Google, or any Top Tech Company
算法学习书籍:Introduction to Algorithms
编程珠玑:Programming Pearls (2nd Edition)
C++ 学习:The C++ Programming Language, 4th Edition
经典操作系统书籍,龙书:Operating System Concepts
创业:The Start-up of You: Adapt to the Future, Invest in Yourself, and Transform Your Career
Given an array of integers, every element appears twice except for one. Find that single one.
Could you implement it without using extra memory?
用位运算很巧妙地做,用res来记录,res^=A[i], 出现两次的话,两次亦或消失为0,只有出现一次的被res记录下来,最后返回0^res.
用位运算很巧妙地做,用res来记录,res^=A[i], 出现两次的话,两次亦或消失为0,只有出现一次的被res记录下来,最后返回0^res.
my one-liner: return accumulate(A, A + n, 0, [](int i, int j) { return i ^ j; });
ReplyDelete