Missing element from array (D&C) - code design/aesthetic improvement
I don't follow the definition:

"Given an array of n-1 numbers (int) from 0 to n, find the missing number".


So if n == 7, as in your example code, there should be 6 numbers (n-1) in the
array.  There are 8 numbers in the the range "0 to n" (0,1,2,3,4,5,6,7).
Perhaps the problem definition meant "0 to n-1" or "0 up to n, not including
n".

Your example code has seven numbers and n == 7:

int n = 7;
int v[] = {7,0,4,1,3,6,2};


I would expect n to be 8 for an array of 7 numbers where one of the 8 is
missing.

Anyway, your example works, printing '5', but if you replace, say the 2 with a 5
it now prints '3'.  Unless I messed up!


On the code, C ignores white space (unlike say Python).  Look at the
if-else chain at the beginning of find:

if (left == right) 
  if (flagR != 0)
    return v[left] + 1;
  if (flagL != 0)
    return v[left] - 1;
else
{
  int exp0 = 0; // expected bits of 0


According to the indentation of statements, you intended the if (flagR != 0)
and if (flagL != 0) to be dependent upon left == right, as in:

if (left == right) {
    if (flagR != 0) {
        return v[left] + 1;
    }
    if (flagL != 0) {
        return v[left] - 1;
    }
}
else {
    int exp0 = 0; // expected bits of 0


But what the compiler will see is

if (left == right) {
    if (flagR != 0) {
        return v[left] + 1;
    }
}
if (flagL != 0) {
    return v[left] - 1;
}
else {
    int exp0 = 0; // expected bits of 0


If you get the editor to re-indent the code for you (or use UNIX indent
command), you will see that your indenting is wrong.  The lesson is always to
use braces to say explicitly what you mean.

The same goes for your other expressions:

for (int i=left+flagL;i&lt;=right+flagR;i++)
  if (get_bit(i,max_bit) == 0)
    exp0++;
  else
    exp1++;


should be more like this:

for (int i = left + flagL; i &lt;= right + flagR; i++) {
    if (get_bit(i, max_bit) == 0) {
        exp0++;
    } else {
        exp1++;
    }
}


In this case, there is no misunderstanding by the compiler but you should add the braces nevertheless - consider what happens if you don't add explicit braces with:

for (int i=left+flagL;i&lt;=right+flagR;i++)
  if (get_bit(i,max_bit) == 0)
    exp0++;
  else
    exp1++;
    something_else();