Skip to content

Commit 0ccd738

Browse files
authored
Update Leetcode 题解.md
更改 位运算 mask部分的一小点说明
1 parent 4776c74 commit 0ccd738

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

docs/notes/Leetcode 题解.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6675,7 +6675,7 @@ x ^ x = 0 x & x = x x | x = x
66756675

66766676
要得到只有第 i 位为 1 的 mask,将 1 向左移动 i-1 位即可,1<<(i-1) 。例如 1<<4 得到只有第 5 位为 1 的 mask :00010000。
66776677

6678-
要得到 1 到 i 位为 1 的 mask,1<<(i+1)-1 即可,例如将 1<<(4+1)-1 = 00010000-1 = 00001111。
6678+
要得到 1 到 i 位为 1 的 mask,(1<<i)-1 即可,例如将 (1<<4)-1 = 00010000-1 = 00001111。
66796679

66806680
要得到 1 到 i 位为 0 的 mask,只需将 1 到 i 位为 1 的 mask 取反,即 \~(1<<(i+1)-1)。
66816681

0 commit comments

Comments
 (0)