Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Break Rings by UFO665
def break_rings(rings):
res = 0
while rings:
lst = []
for s in rings:
lst += list(s)
minCountElem = min(lst, key=lambda x: lst.count(x))
for s in rings:
if minCountElem in s:
elemForDel = s.difference({minCountElem})
break
res += 1
rings = [s for s in rings if len(s.difference(elemForDel)) > 1]
return res
Dec. 11, 2015
Comments: