We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 629369a commit d654806Copy full SHA for d654806
project_euler/problem_112/sol1.py
@@ -47,7 +47,9 @@ def check_bouncy(n: int) -> bool:
47
"""
48
if not isinstance(n, int):
49
raise ValueError("check_bouncy() accepts only integer arguments")
50
- return "".join(sorted(str(n))) != str(n) and "".join(sorted(str(n)))[::-1] != str(n)
+ str_n = str(n)
51
+ sorted_str_n = "".join(sorted(str_n))
52
+ return sorted_str_n != str_n and sorted_str_n[::-1] != str_n
53
54
55
def solution(percent: float = 99) -> int:
0 commit comments