Number of ways to choose 3 nodes in a graph such that all are equidistant from each other. Example:
Input: [1,2] [1,3] [1,4] [1,5]
Output: 4
My approach: 1.Bfs from all nodes 2.ans += NC3 : N = number of nodes on same level.
Problem: Unable to handle case of repetition, Pls look into it and provide me a solution for the same. Ps: ive been stuck on this for a long time :(