Class Solution
-
- All Implemented Interfaces:
public final class Solution3079 - Find the Sum of Encrypted Integers\.
Easy
You are given an integer array
numscontaining positive integers. We define a functionencryptsuch thatencrypt(x)replaces every digit inxwith the largest digit inx. For example,encrypt(523) = 555andencrypt(213) = 333.Return the sum of encrypted elements.
Example 1:
Input: nums = 1,2,3
Output: 6
Explanation: The encrypted elements are
[1,2,3]. The sum of encrypted elements is1 + 2 + 3 == 6.Example 2:
Input: nums = 10,21,31
Output: 66
Explanation: The encrypted elements are
[11,22,33]. The sum of encrypted elements is11 + 22 + 33 == 66.Constraints:
1 <= nums.length <= 501 <= nums[i] <= 1000
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final IntegersumOfEncryptedInt(IntArray nums)-
-
Method Detail
-
sumOfEncryptedInt
final Integer sumOfEncryptedInt(IntArray nums)
-
-
-
-