while(high - low > 1){ int mid = (low + high) / 2; if(check(mid)) low = mid; else high = mid; }