• + 0 comments

    Great solution. Helped me solve my time issue. I had to make adjustments to the array size. If you have issues with 4 test cases after using this advice. Try doing:

    long int *a=new long int[N+2]()

    I am not sure where, but the array had some memory breaches even though it provided correct answer.