Permutation With Spaces Leetcode Javascript