java排列组合的算法 譬如我有(A,B,C,D),我想输出的结果是{A,B,C,D}{AB},{AC},{AD},{BC},{BD},{CD}{ABC},{ABD},{ACD},{BCD}{ABCD}
问题描述:
java排列组合的算法 譬如我有(A,B,C,D),我想输出的结果是
{A,B,C,D}
{AB},{AC},{AD},{BC},{BD},{CD}
{ABC},{ABD},{ACD},{BCD}
{ABCD}
答
import static java.lang.System.*;import java.util.*;public class Test{ public static void main(String...args){ ArrayList<String> l=...