matrix chain multiplication, non recursive way

matrix chain multiplication, non recursive way