Logical Bitwise Operations Problem
Something like this: (?)
uint8_t
Solve(uint8_t n, uint8_t prev_n)
{
    uint8_t result = 0;
    uint8_t group_bits = 0;
    uint8_t mask_bit = 0x80;  

    while (1)
    {
        if (n &amp; mask_bit)
        {
            //If current mask bit is set in n, save it in the current group...
            group_bits |= mask_bit;
        }
        else
        {
            //If current mask bit is not set in n, then we found a group of 1 bits...
            if (prev_n &amp; group_bits)
            {
                //Store to result if any of the current group of 1 bits is set in prev_n...
                result |= group_bits;
            }
            group_bits = 0;
        
            //Break loop if mask_bit shifted right 8 times...
            if (!mask_bit)
            {
                break;
            }
        }
        mask_bit &gt;&gt;= 1;
    }

    return result;
}