Given an undirected graph , count number of triangles. Answer for left graph is 4 and answer for right graph is 1.