Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设一个 6 位数字 abcdef。我们希望在不改变数字顺序的情况下生成所有 3 位数字组合。这意味着 abc, ..., ade, ... def 很好,但不是 bac。那是因为 b 不应该出现在 a 之前。Matlab代码很好。
nchoosek({'a','b','c','d','e'},3) ans = 'a' 'b' 'c' 'a' 'b' 'd' 'a' 'b' 'e' 'a' 'c' 'd' 'a' 'c' 'e' 'a' 'd' 'e' 'b' 'c' 'd' 'b' 'c' 'e' 'b' 'd' 'e' 'c' 'd' 'e'