neighbors
to store the set of neighbors for each node.corridors
list and populate the neighbors
dictionary such that each key-value pair represents a node and its set of connected nodes.ans
to store the number of cycles found.ans
by the number of common nodes found.ans
by 3 to correct for overcounting.ans
.