sir my code giving correct output
but test case not pass
Pairing problem graph
@YASHMATHURIA123
There are few mistakes in your code. I am pointing them
- Final ans can be greater than integer range. Use long long int to store it.
- Line 22 should be z+=dfs1(c,m);
- In function dfs, why are you iterating over l. l contain edges, it might be possible and it doesn’t have edges for all nodes. In that case your ans would not include these node. So iterate from i=0 to i<n
sir line 22 m mai z=dfs1(c,m) likhungaa toh tab bhi toh sahi hai kyu ki har recursion m z=0 le raha hoon .
left or right subtree dono side ka return value add krna hoga. isliye z+=dfs1(c,m) nhi to sirf right subtree hi store hoga