Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6420 |

@blackshadows | 6376 |

@mb1973 | 5578 |

@Quandray | 5231 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 4510 |

@sanjay05 | 3762 |

@kirtidee18 | 3673 |

@marius_valentin_dragoi | 3522 |

@sushant_a | 3459 |

@verma_ji | 3412 |

Complete Leaderboard | |

Handle | Score |

@codersgroup18 | 714 |

@Manikanta punnam | 579 |

@sriramgoparaju99 | 532 |

@yashkaril4 | 517 |

@praveenbgp6 | 517 |

@prankursharma31 | 489 |

@rdakka | 465 |

@sonamnigam1999 | 441 |

@purohitmn02 | 427 |

@sonamkumari63928 | 426 |

@ShubhankarPandey | 419 |

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 with **V **vertices and adjacency list **adj.**

**Example 1:**

Input:Output:2Explanation:The graph contains Eulerian circuit

**Example 2:**

Input:Output:1Explanation:The graph contains Eulerian path.

**Your Task:**

You don't need to read or print anything. Your task is to complete the function **isEulerCircuilt() **which takes number of vertices in the graph denoting as V and adjacency list of graph denoting as adj and returns 1 if graph contains Eulerian Path, 2 if graph contains Eulerian Circuit 0 otherwise.

**Expected Time Complexity: **O(V+E) where E is the number of edges in graph.

**Expected Space Complexity: **O(V)

**Constraints:**

1 ≤ V, E ≤ 10^{4}

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Euler circuit and Path

...