add dynamic programming version of permutations