Given an undirected graph with n vertices and connections between them. Your task is to find whether you can come to same vertex X if you start from X by traversing all the vertices atleast once and use all the paths exactly once.
Example 1:
Input: paths = {{0,1,1,1,1},{1,0,-1,1,-1},
{1,-1,0,1,-1},{1,1,1,0,1},{1,-1,-1,1,0}}
Output: 1
Exaplanation: One can visit the vertices in
the following way:
1->3->4->5->1->4->2->1
Here all the vertices has been visited and all
paths are used exactly once.
Given an undirected graph with n vertices and connections between them. Your task is to find whether you can come to same vertex X if you start from X by traversing all the vertices atleast once and use all the paths exactly once.
Example 1:
Input: paths = {{0,1,1,1,1},{1,0,-1,1,-1}, {1,-1,0,1,-1},{1,1,1,0,1},{1,-1,-1,1,0}} Output: 1 Exaplanation: One can visit the vertices in the following way: 1->3->4->5->1->4->2->1 Here all the vertices has been visited and all paths are used exactly once.