Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
itertools combinations solution solution in Clear category for Break Rings by roenke
import itertools
def break_rings(rings):
nums = set(r for ring_pair in rings for r in ring_pair)
for i in range(len(nums)):
for comb in itertools.combinations(nums, i):
if all(any(r in comb for r in ring_pair) for ring_pair in rings):
return i
June 2, 2016