Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Determinant by freeman_lex
def checkio(M):
def mnr(mat, ind):
res = mat[1:]
for j in range(len(res)):
res[j] = [res[j][l] for l in range(len(res[j])) if l != ind]
return res
def rec(M):
if len(M) == 1:
return M[0] if type(M[0]) == int else M[0][0]
return sum([(-1)**i * M[0][i] * rec(mnr(M, i)) for i in range(len(M))])
return rec(M)
Aug. 8, 2016
Comments: