https://leetcode.com/problems/find-the-sum-of-encrypted-integers/description/
1 2 3 4 5 6 7 8 9 10 | class Solution: def sumOfEncryptedInt(self, nums: List[int]) -> int: answer = 0 for num in nums: str_num = str(num) max_digit = str(max(map(int, list(str_num)))) tmp_answer = int(max_digit * len(str_num)) answer += tmp_answer return answer | cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 3065. Minimum Operations to Exceed Threshold Value I (0) | 2024.04.24 |
---|---|
leetcode 3069. Distribute Elements Into Two Arrays I (0) | 2024.04.24 |
leetcode 3083. Existence of a Substring in a String and Its Reverse (0) | 2024.04.24 |
leetcode 3099. Harshad Number (0) | 2024.04.23 |
leetcode 3046. Split the Array (0) | 2024.04.22 |
댓글