It is passing all the test cases except for the first one.
Not able to understand if its an edge case I am missing or if the solution is wrong.
I have used the property that the graph should have two or zero odd degree nodes to be Euler path.
It is passing all the test cases except for the first one.
Not able to understand if its an edge case I am missing or if the solution is wrong.
I have used the property that the graph should have two or zero odd degree nodes to be Euler path.
Hi,
Your code is not is applicable if we have more than one graph. I have made some changes in your code.
I have first calculated the total number of odd degree points and number of disconnected graphs.
And calculated the maximum among them.
Example:1 Suppose there are four disconnected graphs with no. of odd degree vertices 4 each, then then there will be (16-1)/2 edges to make.
2 Suppose there are four disconnected graphs with no. of odd degree vertices 4,4,0,0. Here we will connect all
four graphs with four edges.
Code link:
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.