Skip to content

Commit 4a64d80

Browse files
Merge pull request #1813 from CodingTestStudy2/김민제
[김민제] Day13
2 parents bba30a0 + 29a0f29 commit 4a64d80

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def largestInteger(self, n: int, s: int) -> int:
3+
if s==0:
4+
return 0
5+
sum_max = 0
6+
return_val = -1
7+
for num in range(10**(n-1),10**n):
8+
temp_max=0
9+
for x in str(num):
10+
temp_max += int(x)
11+
if s == temp_max:
12+
sum_max = max(sum_max,temp_max)
13+
return_val = num
14+
return return_val

0 commit comments

Comments
 (0)