Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Try: understand solution in Creative category for Friends by veky
class Friends(set):
__init__ = lambda self, c: super().__init__(map(frozenset, c))
def add(self, c):
try: return c not in self
finally: super().add(frozenset(c))
def remove(self, c):
try: return c in self
finally: super().discard(c)
names = lambda self: set.union(set(), *self)
connected = lambda self, n: {c for e in self if n in e for c in e - {n}}
Nov. 12, 2014
Comments: