```
// Forward declaration of isBadVersion API.
bool isBadVersion(int version);
class Solution {
public:
int bst(long n1,long n2)
{
if(!isBadVersion(n2-1)&&isBadVersion(n2))return n2;
int l=(n1+n2)/2;
if(!isBadVersion(l)&&isBadVersion(l+1))return l+1;
else if(isBadVersion(l))return bst(n1,l);
else return bst(l+1,n2);
}
int firstBadVersion(int n) {
if(n==0)return 0;
return bst(1,n);
}
};
```

There should be careful !

Using int is not enough to store big number !