Binary Search Problems Leetcode Javascript