I have seen many solutions and they all look like this :
int f( int x)
{ int ans ;
while ( x > 1)
{
ans++ ; x /= 2 ;
}
return ans ;
}
final_ans = max ( f(a) , f(b)) ;
where a and b are no.of rows and no.of columns .
I want to know the logic behind it ?