Two Stack Problem Leetcode Javascript