Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions leetcode3/김민제/4000. Largest Integer With Given Digit Sum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution:
def largestInteger(self, n: int, s: int) -> int:
if s==0:
return 0
sum_max = 0
return_val = -1
for num in range(10**(n-1),10**n):
temp_max=0
for x in str(num):
temp_max += int(x)
if s == temp_max:
sum_max = max(sum_max,temp_max)
return_val = num
return return_val