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

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:

主站蜘蛛池模板: 吴旗县| 乐至县| 新安县| 永川市| 图们市| 淮阳县| 华坪县| 侯马市| 忻城县| 新河县| 齐河县| 个旧市| 邮箱| 平陆县| 洞头县| 津市市| 宜兰市| 新沂市| 越西县| 新巴尔虎右旗| 长阳| 友谊县| 黄山市| 阳新县| 九寨沟县| 茂名市| 龙胜| 林周县| 大邑县| 朔州市| 磴口县| 德安县| 屏东县| 广河县| 弥勒县| 原阳县| 湖北省| 巴林右旗| 咸阳市| 河南省| 乌苏市|