Sample testcase is passed successfully.
Refer for code->
Sample testcase is passed successfully.
Refer for code->
Hello @ambuj_0909,
Your code is failing for Isolated node in the graph:
Example:
1
4 2 2 1
1 3
3 2
Expected Output:
6 (two temples and two road, 4 is isolated)
Also, As per the constraints the cost can be greater than the range of int.
So, use appropriate data type.
Approach:
Hope, this would help.
Give a like if you are satisfied.
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.