3606. Minimum Element After Replacement With Digit Sum
My accepted Python solution to LeetCode problem 3606, Minimum Element After Replacement With Digit Sum, running in 10ms.
- Difficulty: Easy
- Python
- Runtime 10ms
- Memory 17.2MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 10ms, memory 17.2MB, accepted 2026-01-01.
class Solution:
def minElement(self, nums: List[int]) -> int:
def digit_sum(n):
return sum(int(d) for d in str(n))
return min(digit_sum(num) for num in nums)