Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all permutations of a slice

Tags:

go

permutation

I was wondering if there was a way to find all the permutations of an slice filled with characters in Go?

In Python you can use itertools.product with a list or characters or integers, and you can get all the possible permutations.

I have looked to see if there is a package out there, and I cannot seem to find one. Any help would be welcomed.

like image 412
Colum Avatar asked Apr 25 '13 19:04

Colum


1 Answers

Permutations of anything implementing sort.Interface: Permutation{First,Next}

like image 68
zzzz Avatar answered Sep 19 '22 12:09

zzzz