LeetCode- Bit Manipulation LeetCode总结(1) —— 位运算

Bit Manipulation(位运算):主要思想参考《剑指Offer》第二章2.4.3节。        一共五种运算:与,或,异或,左移,右移。   经常使用技巧: (1)n & (n-1)可以消灭n中最右侧的一个1。 (2) 右移:除以2, 左移:乘以2。 (3)异或性质:交换律,0^a=a, a^a=0; (3)将经常使用字符、数字等均转为按位运算,能够节约空间。 LeetCode题目解
相关文章
相关标签/搜索