https://www.spoj.com/problems/BAT2/
I am getting NZEC error in the following python sollution although the sample test case passes.do anyone provide some sample test cases to know where the code is giving nzec.thankyou
def solve(pos,inc,dec):
if pos>=n-1:
return 0
if dp[pos][inc][dec] !=-1:
return dp[pos][inc][dec]
dp[pos][inc][dec]=max(solve(pos+1,pos,dec)+1,solve(pos+1,inc,pos)+1,solve(pos+1,inc,dec))
return dp[pos][inc][dec]
for _ in range(int(input())):
n=int(input())
arr=list(map(int,input().split()))
dp=[[[-1 for i in range(n+1)]for k in range(n+1)]for j in range(n+1)]
zz=solve(0,0,0)
print(zz)