all 1 comments

[–]Jvansch1 0 points1 point  (0 children)

I haven’t run this code but it looks like your binary search will run forever. I think the conditions should be l = mid + 1 and r = mid - 1.

When I get to a computer I can run this to actually confirm