Solutions for Different Bit at Right

    • @Victorfreef
    • @Liam, submitted in Python 3, achived 100% score
    import math
    def getRightMostSetBit(n):
        if (n == 0):
            return 0
    
        return math.log2(n & -n) + 1
    
    
    # Function to find the position of 
    # rightmost different bit in the 
    # binary representations of 'm' and 'n'
    def solve(m, n):
    
        # position of rightmost different
        # bit
        return getRightMostSetBit(m ^ n)
    
    • @Victorfreef
    • @Liam, submitted in Python 3, achived 100% score
    import math
    def getRightMostSetBit(n):
        if (n == 0):
            return 0
    
        return math.log2(n & -n) + 1
    
    
    # Function to find the position of 
    # rightmost different bit in the 
    # binary representations of 'm' and 'n'
    def solve(m, n):
    
        # position of rightmost different
        # bit
        return getRightMostSetBit(m ^ n)