InterviewBit Problems   Remove Duplicates from Sorted Array II : Unsolved

By changing the original array there is TLE and you do not do that in your comple (1)
Anshuman Singh When I submit the code, it fails for an input, but works perfectly (5)
Please see, my solution works fine for the faling test case on IDE and on my mach (2)