We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4776c74 commit 0ccd738Copy full SHA for 0ccd738
1 file changed
docs/notes/Leetcode 题解.md
@@ -6675,7 +6675,7 @@ x ^ x = 0 x & x = x x | x = x
6675
6676
要得到只有第 i 位为 1 的 mask,将 1 向左移动 i-1 位即可,1<<(i-1) 。例如 1<<4 得到只有第 5 位为 1 的 mask :00010000。
6677
6678
-要得到 1 到 i 位为 1 的 mask,1<<(i+1)-1 即可,例如将 1<<(4+1)-1 = 00010000-1 = 00001111。
+要得到 1 到 i 位为 1 的 mask,(1<<i)-1 即可,例如将 (1<<4)-1 = 00010000-1 = 00001111。
6679
6680
要得到 1 到 i 位为 0 的 mask,只需将 1 到 i 位为 1 的 mask 取反,即 \~(1<<(i+1)-1)。
6681
0 commit comments