Leetcode Problems Two Sum Solution Javascript Array Shift