Reverse Array Problem Leetcode Two Sum Javascript