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題目解
相關文章
相關標籤/搜索