Created
August 5, 2017 01:38
-
-
Save inhies/e450aad78984fc4cd9f6681cdcbbe94a to your computer and use it in GitHub Desktop.
Create pairings only once https://play.golang.org/p/UFOP4OTm7r
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
) | |
func main() { | |
a := []int{1, 2, 3, 4, 5} | |
for len(a) > 0 { | |
for i := 1; i < len(a); i++ { | |
fmt.Fprintln(os.Stderr, a[0], a[i]) | |
} | |
a = append(a[:0], a[1:]...) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment