MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / a

Function a

dynamic_programming/matrix_chain_multiplication.py:121–125  ·  view source on GitHub ↗
(i: int, j: int)

Source from the content-addressed store, hash-verified

119
120 @cache
121 def a(i: int, j: int) -> int:
122 return min(
123 (a(i, k) + dims[i] * dims[k] * dims[j] + a(k, j) for k in range(i + 1, j)),
124 default=0,
125 )
126
127 return a(0, len(dims) - 1)
128

Callers 1

matrix_chain_orderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected