I have something like this in my code for a Dynamic Programming problem.
class Solution
{
static int dp[][] = new int[1000][1000];
static int someMethod(int a, int b) {
// use dp[][] somewhere here
// some recursion statements
someMethod(a-x,b-y);
}
}
I want to initialize all values in dp
with -1
instead of 0
. Standard initialization inside method isn't an option because it uses recursion to make multiple calls.
Solution goes into an online judging tool so can't really config anything too. Any plain code solution will be appreciated.