Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
6 lines solution solution in Clear category for Node Disconnected Users by kdim
def disconnected_users(net, users, source, crushes):
if source in crushes: return sum(users.values())
chain = lambda a, b: chain(a | set(*b[:1]), b[1:]) if a & set(*b[:1]) else a
connected = [n for n in net if not set(crushes) & set(n)]
s = chain(set(source), connected)
return sum(users.values()) - sum(users[c] for c in s)
Feb. 10, 2021