int BitFlipRequired::bitFlipRequired(int A, int B){
        int count(0);
        int bitMask(1);

        A ^= B;

        for (unsigned int bitPosition = 0; bitPosition < sizeof(int)*8;
bitPosition++){
                if ((A & bitMask) != 0)
                        count++;
                bitMask <<= 1;
        }
        return count;
}


On Jul 28, 2:43 pm, sylvester <[email protected]> wrote:
> i just read this quetion somewhere...i dont have any idea what exactly
> they mean by this...so m looking for any soln that can be possible....
>
> On Jul 29, 2:19 am, Tim Zheng <[email protected]> wrote:
>
>
>
>
>
>
>
> > What's the basic operation on A allowed here to convert it to B? Just
> > to flip individual bit?
>
> > On Jul 28, 2:14 pm, sylvester <[email protected]> wrote:
>
> > > Given two integers A & B. Determine how many bits required to convert
> > > A to B. Write a function int BitSwapReqd(int A, int B);

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to