UNIONSET - A Simple Approach

looks good ^^

A basic brute force kind of approach worked as well. here is the solution.

Thanks for your feedback! I see, i missed things in implementation. Thought process was same, but yes, i was at fault in implementation. I will make sure to give it another shot with your explanation in mind, THANKS!! :slight_smile:

(Regarding array, i heard it gives a warning but initialises elements to 0. Nonetheless, its better to avoid risky things, undefined behaviour in program is a HUGE headache to debug…)

@vijju123 Nope, it doesn’t initialize all elements to zero. You can check here: http://ideone.com/Sv7wK2

I believe there was discussion on this in codeforces.

1 Like

Can anyone please tell me how to increase karma points? I can’t even ask questions :frowning:

Thanks for the reference! I will keep that in mind in future!! Thanks again dear :slight_smile: