-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Add solution to project euler problem 104 #3404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Kind reminder: @dhruvmanila can you please review this PR. |
""" | ||
from typing import List | ||
|
||
base = [[1, 1], [1, 0]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is a constant please convert the name to all uppercase: BASE
base = [[1, 1], [1, 0]] | ||
|
||
|
||
def matrix_product(a: List[list], b: List[list], mod: int = None) -> List[list]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Descriptive names would look even better :)
Make an alias for the type hint of matrix and then use it everywhere:
Matrix = List[List[int]]
Also, the type hint for mod
is incorrect, as it has a default value of None
, it basically means the argument is optional. Use: Optional[int]
. You will have to import it using from typing import Optional
return tmp | ||
|
||
|
||
def fib(k: int, mod: int = None) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Descriptive variable names, please. Again, use Optional[int]
>>> is_pandigital('839725641') | ||
True | ||
""" | ||
occ = [0] * 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Descriptive variable names, please.
occ
and maybe use letter
instead of i
?
return all(map(lambda x: x == 1, occ[1:])) | ||
|
||
|
||
def solution() -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at point 4 and 5 of project_euler/README.md
in the Coding style part: https://github.com/TheAlgorithms/Python/tree/master/project_euler#coding-style
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.