Your solution fails on the same testcase as this one
Though probably for a different reason.
sorry to disturb but can you give smaller test case than this ? please
i am getting 3 23 10 21 which is correct i have compared the answer with your program given in that thread.
Oh, sorry - my mistake - I gave you the wrong test input entirely
Try this (smaller) one instead:
10 1 1 1 2 1 1 2 2 2 2
Bro you are just awesome
love you #nohomo