Help me in solving SUMMODE problem

My issue

How sum is 12 in test case 2. It should be 10

Problem Link: Sum of Modes Practice Coding Problem


you should see explaination
i think you miss two occurence of 0 and 1;
thus getting sum as 10