public int numTreesDP(int n, Integer [] DP) {
        if(DP[n] != null) {
            return DP[n];
        }
        DP[n] = 0;
        for(int i = 1; i <= n; ++i){
            int l = numTreesDP(i-1, DP);
            int r = numTreesDP(n-i, DP);
            DP[n] += l * r;
        }
        return DP[n];
    }