mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Improve Project Euler problem 145 solution 1 (#6141)
* updating DIRECTORY.md * Improve solution * updating DIRECTORY.md * Fix Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
parent
a28ad3f759
commit
de4d98081b
|
@ -112,6 +112,7 @@
|
|||
* [Cnn Classification](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/cnn_classification.py)
|
||||
* [Flip Augmentation](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/flip_augmentation.py)
|
||||
* [Harris Corner](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/harris_corner.py)
|
||||
* [Horn Schunck](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/horn_schunck.py)
|
||||
* [Mean Threshold](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/mean_threshold.py)
|
||||
* [Mosaic Augmentation](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/mosaic_augmentation.py)
|
||||
* [Pooling Functions](https://github.com/TheAlgorithms/Python/blob/master/computer_vision/pooling_functions.py)
|
||||
|
@ -131,6 +132,7 @@
|
|||
* [Molecular Chemistry](https://github.com/TheAlgorithms/Python/blob/master/conversions/molecular_chemistry.py)
|
||||
* [Octal To Decimal](https://github.com/TheAlgorithms/Python/blob/master/conversions/octal_to_decimal.py)
|
||||
* [Prefix Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/prefix_conversions.py)
|
||||
* [Prefix Conversions String](https://github.com/TheAlgorithms/Python/blob/master/conversions/prefix_conversions_string.py)
|
||||
* [Pressure Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/pressure_conversions.py)
|
||||
* [Rgb Hsv Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/rgb_hsv_conversion.py)
|
||||
* [Roman Numerals](https://github.com/TheAlgorithms/Python/blob/master/conversions/roman_numerals.py)
|
||||
|
@ -529,6 +531,7 @@
|
|||
* [Perfect Square](https://github.com/TheAlgorithms/Python/blob/master/maths/perfect_square.py)
|
||||
* [Persistence](https://github.com/TheAlgorithms/Python/blob/master/maths/persistence.py)
|
||||
* [Pi Monte Carlo Estimation](https://github.com/TheAlgorithms/Python/blob/master/maths/pi_monte_carlo_estimation.py)
|
||||
* [Points Are Collinear 3D](https://github.com/TheAlgorithms/Python/blob/master/maths/points_are_collinear_3d.py)
|
||||
* [Pollard Rho](https://github.com/TheAlgorithms/Python/blob/master/maths/pollard_rho.py)
|
||||
* [Polynomial Evaluation](https://github.com/TheAlgorithms/Python/blob/master/maths/polynomial_evaluation.py)
|
||||
* [Power Using Recursion](https://github.com/TheAlgorithms/Python/blob/master/maths/power_using_recursion.py)
|
||||
|
@ -619,6 +622,7 @@
|
|||
* [Tower Of Hanoi](https://github.com/TheAlgorithms/Python/blob/master/other/tower_of_hanoi.py)
|
||||
|
||||
## Physics
|
||||
* [Horizontal Projectile Motion](https://github.com/TheAlgorithms/Python/blob/master/physics/horizontal_projectile_motion.py)
|
||||
* [N Body Simulation](https://github.com/TheAlgorithms/Python/blob/master/physics/n_body_simulation.py)
|
||||
* [Newtons Second Law Of Motion](https://github.com/TheAlgorithms/Python/blob/master/physics/newtons_second_law_of_motion.py)
|
||||
|
||||
|
@ -833,6 +837,8 @@
|
|||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_101/sol1.py)
|
||||
* Problem 102
|
||||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_102/sol1.py)
|
||||
* Problem 104
|
||||
* [Sol](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_104/sol.py)
|
||||
* Problem 107
|
||||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_107/sol1.py)
|
||||
* Problem 109
|
||||
|
@ -857,6 +863,8 @@
|
|||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_135/sol1.py)
|
||||
* Problem 144
|
||||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_144/sol1.py)
|
||||
* Problem 145
|
||||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_145/sol1.py)
|
||||
* Problem 173
|
||||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_173/sol1.py)
|
||||
* Problem 174
|
||||
|
@ -990,6 +998,7 @@
|
|||
* [Manacher](https://github.com/TheAlgorithms/Python/blob/master/strings/manacher.py)
|
||||
* [Min Cost String Conversion](https://github.com/TheAlgorithms/Python/blob/master/strings/min_cost_string_conversion.py)
|
||||
* [Naive String Search](https://github.com/TheAlgorithms/Python/blob/master/strings/naive_string_search.py)
|
||||
* [Ngram](https://github.com/TheAlgorithms/Python/blob/master/strings/ngram.py)
|
||||
* [Palindrome](https://github.com/TheAlgorithms/Python/blob/master/strings/palindrome.py)
|
||||
* [Prefix Function](https://github.com/TheAlgorithms/Python/blob/master/strings/prefix_function.py)
|
||||
* [Rabin Karp](https://github.com/TheAlgorithms/Python/blob/master/strings/rabin_karp.py)
|
||||
|
|
|
@ -23,10 +23,11 @@ def odd_digits(num: int) -> bool:
|
|||
>>> odd_digits(135797531)
|
||||
True
|
||||
"""
|
||||
num_str = str(num)
|
||||
for i in ["0", "2", "4", "6", "8"]:
|
||||
if i in num_str:
|
||||
while num > 0:
|
||||
digit = num % 10
|
||||
if digit % 2 == 0:
|
||||
return False
|
||||
num //= 10
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user