pub fn is_unique_chars_bit(word: &str) -> bool {
    if word.len() > 128 {
        return false;
    }
    let mut checker = 0;

    for ch in word.chars() {
        let val = ch as i32 - 'a' as i32;
        if (checker & (1 << val)) > 0 {
            return false;
        }
        checker |= 1 << val;
    }

    true
}
/// Takes a &str and check that all chars is unique
///
/// Time complexity O(n) and Space complexity O(1)
/// Here we also reduce the space complexity with eight from the previous solution
/// by using a bit-vector instead of hashset
///
/// In this case we assume that word is using only lowercase letters a..z
Takes a &str and check that all chars is unique
Time complexity O(n) and Space complexity O(1)
Here we also reduce the space complexity with eight from the previous solution
by using a bit-vector instead of hashset

In this case we assume that word is using only lowercase letters a..z
Takes a &str and check that all chars is unique Time complexity O ( n ) and Space complexity O ( 1 ) Here we also reduce the space complexity with eight from the previous solution by using a bit - vector instead of hashset In this case we assume that word is using only lowercase letters a .. z
pub fn is_unique_chars_bit(word: &str) -> bool {
    if word.len() > 128 {
        return false;
    }
    let mut checker = 0;
    for ch in word.chars() {
        let val = ch as i32 - 'a' as i32;
        if (checker & (1 << val)) > 0 {
            return false;
        }
        checker |= 1 << val;
    }
    true
}
pub fn is_unique_chars_bit ( word : & str ) -> bool { if word . len ( ) > 128 { return false ; } let mut checker = 0 ; for ch in word . chars ( ) { let val = ch as i32 - 'a' as i32 ; if ( checker & ( 1 << val ) ) > 0 { return false ; } checker |= 1 << val ; } true }
Takes a &str and check that all chars is unique
Time complexity O(n) and Space complexity O(1)
Here we also reduce the space complexity with eight from the previous solution
by using a bit-vector instead of hashset
Takes a &str and check that all chars is unique Time complexity O ( n ) and Space complexity O ( 1 ) Here we also reduce the space complexity with eight from the previous solution by using a bit - vector instead of hashset
word
&str
word
&str