Skip to main content

lowest_set_bit

Function lowest_set_bit 

Source
pub fn lowest_set_bit(n: u64) -> u64
Expand description

Eng past 1 bitni ajratib oladi: n & (-n).

Fenwick tree (BIT) ma’lumot strukturasining asosi.

§Misol

use rust_algorithms::numbers::lowest_set_bit;

assert_eq!(lowest_set_bit(12), 4); // 1100 → 0100
assert_eq!(lowest_set_bit(0), 0);