Leetcode String Permutations Java