How to convert this function from recursive to iterative?
问题 I have this method: static List<string> permutation(List<string> lst) { switch (lst.Count) { case 0: case 1: return lst; default: List<string> l = new List<string>(); for (int i = 0; i < lst.Count; i++) { string m = lst[i]; List<string> remLst = lst.Except(new List<string> { m }).ToList(); List<string> tmp = permutation(remLst); for (int i2 = 0; i2 < tmp.Count; i2++) { l.Add(m + tmp[i2]); } } return l; } } which gives all permutations of the list lst . The idea is to one by one extract all