Can you tell my mistake?

for which testcase you are getting wrong ans??

i checked and code is correct

In my compiler, it was showing as error…It was showing that there is ambiguous reference to pair.

this is because there is inbuilt class named pair also

so change the name of your class to Pair (P capital)

Sir, It is still not coming.
I gave the following input.
8 10 1 -1 -1 6 9 -1 -1 7 -1 -1 3 -1 14 13 -1 -1 -1

sorry i missed your doubt

Modified code

mistake

  1. change the name of Class
  2. return from base case
  3. make the class public

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.