Class Solution
-
- All Implemented Interfaces:
public final class Solution3300 - Minimum Element After Replacement With Digit Sum.
Easy
You are given an integer array
nums.You replace each element in
numswith the sum of its digits.Return the minimum element in
numsafter all replacements.Example 1:
Input: nums = 10,12,13,14
Output: 1
Explanation:
numsbecomes[1, 3, 4, 5]after all replacements, with minimum element 1.Example 2:
Input: nums = 1,2,3,4
Output: 1
Explanation:
numsbecomes[1, 2, 3, 4]after all replacements, with minimum element 1.Example 3:
Input: nums = 999,19,199
Output: 10
Explanation:
numsbecomes[27, 10, 19]after all replacements, with minimum element 10.Constraints:
1 <= nums.length <= 100<code>1 <= numsi<= 10<sup>4</sup></code>
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final IntegerminElement(IntArray nums)-
-
Method Detail
-
minElement
final Integer minElement(IntArray nums)
-
-
-
-