Set the rightmost unset bit

PHOTO EMBED

Thu May 23 2024 21:06:20 GMT+0000 (Coordinated Universal Time)

Saved by @ayushg103 #c++

int setBit(int n)
    {
        // Write Youwhile(r Code here
        int count=0;
        while((n%2)!=0)
    {
        n=n>>1;
        count++;
    }
    n=n+1;
    for(int i=0;i<count;++i)
    {
        n=n*2+1;
    }
        return n;
    }
content_copyCOPY