dsa11 min read
Sqrt(x) — Right-Boundary Binary Search [LC 69, Google, Apple]
Compute the integer square root (floor) of x using right-boundary binary search. Find the largest k where k*k <= x, understand the upper-mid trick, and learn why this is the mirror image of the left-boundary template.
Read →