Mobile Numeric Keypad Leetcode Javascript Question