Next Greater Integer Leetcode Javascript Question