Skip to content

Commit 199cb02

Browse files
committed
feat: Add ClearLeftmostSetBit new algorithm with Junit tests
1 parent 0027f57 commit 199cb02

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/com/thealgorithms/bitmanipulation/ClearLeftmostSetBit.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
package com.thealgorithms.bitmanipulation;
22

3+
/**
4+
* ClearLeftmostSetBit class contains a method to clear the leftmost set bit of a number.
5+
* The leftmost set bit is the leftmost bit that is set to 1 in the binary representation of a number.
6+
*
7+
* Example:
8+
* 26 (11010) -> 10 (01010)
9+
* 1 (1) -> 0 (0)
10+
* 7 (111) -> 3 (011)
11+
* 6 (0110) -> 2 (0010)
12+
*
13+
* @author Hardvan
14+
*/
315
public class ClearLeftmostSetBit {
416

517
/**

0 commit comments

Comments
 (0)