From 0e337633db9621075519db804daf47d88e4673aa Mon Sep 17 00:00:00 2001 From: Andre Sanches Date: Thu, 10 Oct 2024 02:41:51 +0000 Subject: [PATCH] fix(binary cheatsheet): corrected bit shift direction to set Kth bit --- apps/website/contents/algorithms/binary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/website/contents/algorithms/binary.md b/apps/website/contents/algorithms/binary.md index 367049a1..4ae72024 100644 --- a/apps/website/contents/algorithms/binary.md +++ b/apps/website/contents/algorithms/binary.md @@ -47,7 +47,7 @@ Some helpful utility snippets: | Technique | Code | | --- | --- | | Test kth bit is set | `num & (1 << k) != 0` | -| Set kth bit | num |= (1 >> k) | +| Set kth bit | num |= (1 << k) | | Turn off kth bit | `num &= ~(1 << k)` | | Toggle the kth bit | `num ^= (1 << k)` | | Multiply by 2k | `num << k` |