Problem statement:

Given matrices A1, A2, .... An, find a way to compute their
product using the minimum number of elementary multiplications.
Matrix multiplication is associative, but not commutative.
So, given A1, A2, A3, you can compute their product by doing
(A1 * A2) * A3 or A1 * (A2 * A3) but not (A1 * A3) * A2.

If matrices A, B are m by n and n by p, then computing A * B
requires m * n * p elementary multiplications, and produces
an m by p matrix.

You must implement sequence.solve(dimensions). Dimensions
has one element for each matrix A1 ... An, such that matrix
Ai is dimensions[i][0] by dimensions[i][1]. Assume
multiplication is possible, i.e.
dimensions[i][1] = dimensions[i - 1][0].

You must return a multiplication plan made out of nested lists.
The general idea is that A1 * (A2 * A3) would be turned into
[0, [1, 2]]. A list should have exactly two elements, because:
(1) elementary matrices should not be wrapped by paranthesis
(2) the paranthesis must specify a plan without any ambiguity;
[0, 1, 2] would translate to (A1 * A2 * A3) which is ambiguous.
