4chan archive /g/ (index)
2012-10-02 12:47 28002591 Anonymous (notifica.jpg 200x200 14kB)
Hy, java-fag wannabe here.
I have to calculate a combination of letters/numbers.
Example:
given "a", "b", "c", "1", "9", "0"
i need to calculate all the combination of those, but i need to calculate it in multi dimension
all the conbination of 3 of those, all the combination of 4, all the combination of 5
How to do it with java?
5 min later 28002640 Anonymous
import itertools
for x in range(3):
itertools.permutations(["a", "b", "c", "1", "9", "0",] x)
Oh, nevermind, stick to your precious Java for your homework.
6 min later 28002648 Anonymous
>>28002640
>for x in range(3):
Should be for x in range(3, 6):
10 min later 28002687 Anonymous
up
1 hours later 28003377 Anonymous
http://en.wikipedia.org/wiki/Permutation#Algorithms_to_generate_permutations
0.341 0.015