Skip to content

Commit 32ab189

Browse files
committed
Created problem_38 in project_euler . TheAlgorithms#2695
Added problem_38 folder with solution file sol.py. TheAlgorithms#2695
1 parent e9865ae commit 32ab189

File tree

1 file changed

+9
-0
lines changed
  • project_euler/problem_38

1 file changed

+9
-0
lines changed

project_euler/problem_38/sol.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def solution():
2+
answer = ""
3+
for n in range(2, 10):
4+
for a in range(1, 10**(9 // n)):
5+
s = "".join(str(a * j) for j in range(1, n + 1))
6+
randomv = "".join(sorted(s))
7+
if randomv == "123456789":
8+
answer = max(s, answer)
9+
return answer

0 commit comments

Comments
 (0)