Solve the Matrix Chain Multiplication problem