the code implemented by sir is not passing the all the test cases
Input:
10 3
1 2 3 -3 -2 -1 4 1 0 1
Its Correct output is:
8
And Your Code’s output is:
6
the code implemented by sir is not passing the all the test cases
Input:
10 3
1 2 3 -3 -2 -1 4 1 0 1
Its Correct output is:
8
And Your Code’s output is:
6
Oh , You have to check the first occurrence of pre.
if pre is already present in mp, you don’t have to update mp[pre].
Please add a additional conditiont there.