<doocs>0397.Integer Replacement_1.py
def integerReplacement( n: int) -> int:
    ans = 0
    while n != 1:
        if (n & 1) == 0:
            n >>= 1
        elif n != 3 and (n & 3) == 3:
            n += 1
        else:
            n -= 1
        ans += 1
    return ans
def sample_funcname ( var_0 : int ) -> int :
    var_3 = 0
    while var_0 != 1 :
        if ( var_0 & 1 ) == 0 :
            var_0 >>= 1
        elif var_0 != 3 and ( var_0 & 3 ) == 3 :
            var_0 += 1
        else :
            var_0 -= 1
        var_3 += 1
    return var_3
