A maze consists of n rooms numbered from 1−n, and some rooms are connected by corridors. You are given a 2D integer array, corridors, where corridors[i]=[room1,room2] indicates that there is a corridor connecting room1 and room2, allowing a person in the maze to go from room1 to room2 and vice versa.
The designer of the maze wants to know how confusing the maze is. The confusion score of the maze is the number of different cycles of length 3.
For example, 1→2→3→1 is a cycle of length 3, but ...
A maze consists of n rooms numbered from 1−n, and some rooms are connected by corridors. You are given a 2D integer array, corridors, where corridors[i]=[room1,room2] indicates that there is a corridor connecting room1 and room2, allowing a person in the maze to go from room1 to room2 and vice versa.
The designer of the maze wants to know how confusing the maze is. The confusion score of the maze is the number of different cycles of length 3.
For example, 1→2→3→1 is a cycle of length 3, but ...