<p>Any idea to make the best code for combination :
with this :</p>
<pre><code>letters := []string{"a", "b", "c", "d"}
</code></pre>
<p>to have :
a
ab
ac
ad
abc
abd
b
bc
bcd
etc ...</p>
<p>regards and thanks</p>
<hr/>**评论:**<br/><br/>danredux: <pre><p>Here:</p>
<pre><code>[]string{"a","b","c","d","aa","ab","ac","ad","ba","bb","bc","bd","ca","cb","cc","cd","da","db","dc","dd","aaa","aab","aac","aad","aba","abb","abc","abd","aca","acb","acc","acd","ada","adb","adc","add","baa","bab","bac","bad","bba","bbb","bbc","bbd","bca","bcb","bcc","bcd","bda","bdb","bdc","bdd","caa","cab","cac","cad","cba","cbb","cbc","cbd","cca","ccb","ccc","ccd","cda","cdb","cdc","cdd","daa","dab","dac","dad","dba","dbb","dbc","dbd","dca","dcb","dcc","dcd","dda","ddb","ddc","ddd","aaaa","aaab","aaac","aaad","aaba","aabb","aabc","aabd","aaca","aacb","aacc","aacd","aada","aadb","aadc","aadd","abaa","abab","abac","abad","abba","abbb","abbc","abbd","abca","abcb","abcc","abcd","abda","abdb","abdc","abdd","acaa","acab","acac","acad","acba","acbb","acbc","acbd","acca","accb","accc","accd","acda","acdb","acdc","acdd","adaa","adab","adac","adad","adba","adbb","adbc","adbd","adca","adcb","adcc","adcd","adda","addb","addc","addd","baaa","baab","baac","baad","baba","babb","babc","babd","baca","bacb","bacc","bacd","bada","badb","badc","badd","bbaa","bbab","bbac","bbad","bbba","bbbb","bbbc","bbbd","bbca","bbcb","bbcc","bbcd","bbda","bbdb","bbdc","bbdd","bcaa","bcab","bcac","bcad","bcba","bcbb","bcbc","bcbd","bcca","bccb","bccc","bccd","bcda","bcdb","bcdc","bcdd","bdaa","bdab","bdac","bdad","bdba","bdbb","bdbc","bdbd","bdca","bdcb","bdcc","bdcd","bdda","bddb","bddc","bddd","caaa","caab","caac","caad","caba","cabb","cabc","cabd","caca","cacb","cacc","cacd","cada","cadb","cadc","cadd","cbaa","cbab","cbac","cbad","cbba","cbbb","cbbc","cbbd","cbca","cbcb","cbcc","cbcd","cbda","cbdb","cbdc","cbdd","ccaa","ccab","ccac","ccad","ccba","ccbb","ccbc","ccbd","ccca","cccb","cccc","cccd","ccda","ccdb","ccdc","ccdd","cdaa","cdab","cdac","cdad","cdba","cdbb","cdbc","cdbd","cdca","cdcb","cdcc","cdcd","cdda","cddb","cddc","cddd","daaa","daab","daac","daad","daba","dabb","dabc","dabd","daca","dacb","dacc","dacd","dada","dadb","dadc","dadd","dbaa","dbab","dbac","dbad","dbba","dbbb","dbbc","dbbd","dbca","dbcb","dbcc","dbcd","dbda","dbdb","dbdc","dbdd","dcaa","dcab","dcac","dcad","dcba","dcbb","dcbc","dcbd","dcca","dccb","dccc","dccd","dcda","dcdb","dcdc","dcdd","ddaa","ddab","ddac","ddad","ddba","ddbb","ddbc","ddbd","ddca","ddcb","ddcc","ddcd","ddda","dddb","dddc","dddd"}
</code></pre></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传