In this problem, from what I have understood, we just have to find the largest connected component (components consist of the same numbers) and among the largest connected components choose the one with the least strength. My implementation is passing most of the test cases and failing only 3. Could someone please help me?
You are printing
cnt instead of
These tests must be incredibly weak if that passed so many of them