0ms - beats 100% || efficient solution || complete solution
IntuitionWe need to compute the digit sum for each number in the array and then determine the smallest of these sums. The digit sum of a number is the sum of al
# Intuition
We need to compute the digit sum for each number in the array and then determine the smallest of these sums. The digit sum of a number is the sum of all its individual digits.

---

# Approach
1. **Iterate through each number in the array:**  
   For every number, calculate the sum of its digits by repeatedly extracting the last digit (using modulo 10) and then removing that digit (using division by 10).

2. **Update the minimum digit sum:**  
   Use a variable to keep track of the minimum digit sum seen so far.

3. **Return the result:**  
   After processing all numbers, return the minimum digit sum.

---

# Complexity
- **Time Complexity:** \( O(n \times d) \)  
  Here, \( n \) is the number of elements in the array, and \( d \) is the number of digits in each number (which is constant with the given constraints).

- **Space Complexity:** \( O(1) \)  
  Only a few extra variables are used, so the space usage is constant.

---

# Code
```cpp
class Solution {
public:
    int minElement(vector<int>& nums) {
        
        int res = INT_MAX;

        for (auto num : nums){
            
            int sum = 0;
            int n = num;

            while(n > 0){
                sum += n % 10;
                n /= 10;
            }

            res = min(res, sum);
        }
        
        return res;
    }
};
```
['C++']