How would this work if during bottomright to top left, we are doing
dpRows[i][j] += dpRows[i+1][j]; as in dpRows[n][n] might be 1 which means numbers of enemies that can be killed in nth row dpRows[n][n]=1 and suppose dpRows[n][n-1] is also 1 and arr[n][n] and arr[n][n-1] both are '0'. so value of dpRows[n][n-1] becomes 2 which is wrong.
I have thought something like this .
create 4 dparrays , 2 dpRows , 2 dpColums , one for topleft to bottom right and one for bottom right to top left . We add 2 dpRows ( while adding subtract 1 if arr[i][j]==X to remove overlapping) .
We add 2 dpColums like above. Then we add two final dpRow and dpColumn and check the cells where arr[i][j]=='0'.
Let me know your input.