```
class Solution {
public:
int firstBadVersion(int n, int s=1) {
int mid = s+ n/2;
if(n/2 == 0)
{
if(isBadVersion(mid)) return mid;
else if( n >=2) return mid+1;
}
if(isBadVersion(mid))
firstBadVersion(n/2,s);
else
firstBadVersion(n/2,mid+1);
}
```

};