Skip to content

Instantly share code, notes, and snippets.

@heshamnaim
heshamnaim / prancing_pony.py
Last active August 9, 2017 20:35
Prancing Pony
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()
@heshamnaim
heshamnaim / prancing_pony.go
Created August 9, 2017 20:18
Prancing Pony (Golang)
package main
import (
"fmt"
"time"
"strings"
)
func palindromeCombinations(dwarf_names []string) <-chan []string {