solved it with DP[i,j,h] but solution exists with DP[i,j]