Here is my approach: https://ide.codingblocks.com/#/s/24207
I’m trying to solve this question: https://hack.codingblocks.com/contests/c/511/766
The answer is 3 but I’m getting it as 7 and I cant figure out why. Please guide if I have made any mistakes.