binary search solution for sqrt