3079. Find the Sum of Encrypted Integers

Обновлено: 2024-03-17
1 мин
[]

Содержание

LeetCode problem 3079

class Solution:
    def sumOfEncryptedInt(self, nums: List[int]) -> int:
        s = 0
        for num in nums:
            str_num = str(num)
            max_digit = max(str_num)
            encrypted_num = int(max_digit * len(str_num))
            s += encrypted_num

        return s