Why is this hash[i-1][j-1] + 1 ? I thought that it should be hash[i][j-1] + 1