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" | |
| "time" | |
| "strings" | |
| ) | |
| func palindromeCombinations(dwarf_names []string) <-chan []string { |
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
| from itertools import permutations,combinations | |
| import time | |
| start_time = time.time() | |
| def palindrome_combinations(dwarf_names): | |
| start_time = time.time() | |
| for i in xrange(0,len(dwarf_names)): | |
| for j in list(combinations(dwarf_names,i+1)): | |
| for k in list(permutations(j)): | |
| combination = "".join(k).lower() |