int Solution::solve(int A) { return __builtin_ctz(A); }
how about this one liner…
int Solution::solve(int A) { return log2(A^(A&(A-1))); }
and this return log2(A&(-A));
return log2(A&(~(A-1))) ;