soi-manim/binary-search/binary-search.cpp

8 lines
103 B
C++

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