官术网_书友最值得收藏!

3. Combinations

A combination is an unordered selection of objects from a set. For example, if the set is {apple, banana, cherry}, then the combinations containing two items are all of the subsets containing two items in any order. Those combinations are {apple, banana}, {apple, cherry}, and {banana, cherry}. This time, {apple, banana} and {banana, apple} are considered the same, so the combinations only include one of those subsets.

Write an extension method that returns a List<List<T>>, holding the combinations of a specified length from an array of items. If the specified length is zero, return all combinations of all lengths.

Write a program similar to the one shown in the following screenshot to test your method:

主站蜘蛛池模板: 青海省| 瑞安市| 东至县| 嘉义市| 尼玛县| 万州区| 新龙县| 綦江县| 卫辉市| 根河市| 改则县| 城口县| 常州市| 保亭| 册亨县| 顺昌县| 莎车县| 长沙县| 玉环县| 万荣县| 来宾市| 迁安市| 黑水县| 孟州市| 广东省| 大城县| 阳春市| 曲周县| 凤阳县| 团风县| 永昌县| 清流县| 冕宁县| 扬州市| 大余县| 萨迦县| 北川| 石楼县| 西丰县| 神木县| 剑河县|