Tag: backtracking

如何为给定字符串键入集合

可能重复: 如何获得子集的所有可能组合? 我正在尝试为给定字符串键入集合,例如“123”会给{1} {2} {3} {13} {23} {12} {123} {}但我的代码会给我1 1请任何人告诉我为什么,请帮助我修复它谢谢大家 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TestAAD { class Program { static List sets = new List(); static int len = 0; private static void Generte_Sets(string str, int i) { sets.Add(str[i].ToString()); if (i < len) Generte_Sets(str, i + 1); else { […]