garimasingh128 / CP-DSA-Cpp-C

🕺 Give me data and I will structure it! 🔥
85 stars 118 forks source link

Added programme for Count sub-matrices . #71

Closed Shreyas12345678 closed 3 years ago

Shreyas12345678 commented 4 years ago

Given a n x n matrix of integers and a positive integer k. The problem is to count all sub-matrices having sum divisible by the given value k. if : Input : mat[][] = { {5, -1, 6}, {-2, 3, 8}, {7, 4, -9} }

    k = 4

Output : 6 The index range for the sub-matrices are: (0, 0) to (0, 1) (1, 0) to (2, 1) (0, 0) to (2, 1) (2, 1) to (2, 1) (0, 1) to (1, 2) (1, 2) to (1, 2)