Add Project Euler problem 116 solution 1 (#6305)

* Add solution

* updating DIRECTORY.md

* Fix pre-commit

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
This commit is contained in:
Maxim Smolskiy
2022-09-24 20:04:00 +03:00
committed by GitHub
parent 91c671ebab
commit a0b0f414ae
4 changed files with 71 additions and 2 deletions

View File

@ -29,7 +29,8 @@ def inverse_of_matrix(matrix: list[list[float]]) -> list[list[float]]:
D = Decimal # An abbreviation for conciseness
# Check if the provided matrix has 2 rows and 2 columns, since this implementation only works for 2x2 matrices
# Check if the provided matrix has 2 rows and 2 columns
# since this implementation only works for 2x2 matrices
if len(matrix) != 2 or len(matrix[0]) != 2 or len(matrix[1]) != 2:
raise ValueError("Please provide a matrix of size 2x2.")