Skip to main content
1 of 2

Matrix multiplication range queries

I have a huge list of matrix i.e A = {M0, M1, M2 .. Mn}. I have a task to find the product of all the matrices in a given range {x,y} i.e Mx * Mx+1 * Mx+2 ... * My.

I would like to know if there is any algorithm or data structures that might efficiently compute this query.

I have tried creating a 2D matrix of all possible combination of range but as my initial matrix is very big this does not seem like a practical solution.