Relifious People


whats wrong in the code?

https://ide.codingblocks.com/s/464559 whats wrong in the code?

hello @samardeep

there are cases where nodes are not part of any edge.
in such cases ur map will have entires for them and hence u will never add cost of bulding temple at such isolated vertex

please provide me a test case.

try this->
1
3 0 2 1

https://ide.codingblocks.com/s/466564 now whats wrong?

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.