Error
|
|
---|---|
@Ibrahim Nash | 5765 |
@blackshadows | 5715 |
@akhayrutdinov | 5111 |
@mb1973 | 4993 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 1272 |
@bt8816103042 | 739 |
@rohitanand | 495 |
@codeantik | 479 |
@shalinibhataniya1097 | 472 |
@amrutakashikar2 | 464 |
@thealchemist627 | 456 |
@shivanandp12345678910 | 453 |
@dalwainazism125 | 453 |
@akashkale117 | 453 |
@SherlockHolmes3 | 447 |
Complete Leaderboard |
Eulerian Path is a path in graph that visits every edge exactly once. Eulerian Circuit is an Eulerian Path which starts and ends on the same vertex. The task is to find that there exists the Euler Path or circuit or none in given undirected graph.
Input:
First line consists of test cases T. First line of every test case consists of 2 integers V and E, denoting the number of vertex and edges. Second line of every test case consists of 2*E spaced integers denoting the edge connected.
Output:
Return the int value to print 1 if Euler path exists print 2 if Euler cycle exists else 0.
Constraints:
1<=T<=100
2<=V<=100
1<=E<=100
Example:
Input:
1
5 5
1 0 0 2 2 1 0 3 3 4
Output:
1
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes