String Encode And Decode Leetcode Problems Javascript Array