I am trying to solve this since a lot of time but getting wrong answer for larger value of N. Here is [Removed ]. I have solved successfully this problem which is exactly same problem but with small constraints. I am not able to figure out what is wrong with this solution. Any help would be appreciated !!!