Nth Magical Number Leetcode Problems Javascript Array Push At Index