Binary Search Questions Leetcode Javascript