You need solid understanding of sorted arrays and index manipulation. Binary search repeatedly halves the search space by comparing the middle element, so you must be comfortable with calculating midpoints and adjusting boundaries correctly.
If you struggle with off-by-one errors in loops, practice basic binary search on paper until the boundary conditions become intuitive. Knowing whether to use left < right or left <= right makes the difference between correct and infinite loops.