오늘의 리트코드
네자리 숫자에서 조합할 수 있는 숫자 두개의 합 중 가장 작은 것을 찾아내는 문제이다.
class Solution:
def minimumSum(self, num: int) -> int:
num = sorted(map(int, str(num)))
return sum(num[:2]) * 10 + sum(num[2:])
'Leetcode' 카테고리의 다른 글
Leetcode 17. Letter Combinations of a Phone Number (0) | 2022.05.09 |
---|---|
Leetcode 532. K-diff Pairs in an Array (0) | 2022.02.10 |
Leetcode 938. Range Sum of BST (0) | 2021.12.14 |
Leetcode 26. Remove Duplicates from Sorted Array (0) | 2021.12.12 |
Leetcode 563. Binary Tree Tilt (0) | 2021.12.09 |