diff --git a/2435. Paths in Matrix Whose Sum Is Divisible by K b/2435. Paths in Matrix Whose Sum Is Divisible by K new file mode 100644 index 0000000..c05107f --- /dev/null +++ b/2435. Paths in Matrix Whose Sum Is Divisible by K @@ -0,0 +1,34 @@ +// no branch +class Solution { +public: + static int numberOfPaths(vector>& grid, int k) { + const int m=grid.size(), n=grid[0].size(); + const int mod=1e9+7; + int dp[2][n][k]; + memset(dp, 0, sizeof(dp)); + dp[0][0][(k-grid[0][0]%k)%k]=1; + for(int j=1; j