leetcode sqrt(x) o(logn) solution