Upper Bound In Leetcode Javascript Practice