F. Consecutive Subsequence - Help

I am getting WA verdict on this problem and am unable to figure out why. It would be great if anyone can help me find that.
Here’s a link to my solution : Link
Thanks :slight_smile:

I think you are compressing values in a wrong way. Suppose array A[]={2,6,9,10}. So you are mapping these non consecutive values to consecutive values as {1,2,3,4} which will give wrong answer.

1 Like

Yeah thank you…
Nice catch :wink: