Getting wrong answer in all testcases

code

Hello @vg5823967,

When t>1:
After executing the first test case, your code will print true for all the successive test cases.
Reason:
ans is a global variable.
So, ans will become >=2 after executing the first test case.

Solution:
make ans=0 before function call.

I have corrected your code:

Hope, this would help.
Give a like if you are satisfied.