Minimum Digit Sum Finder | Beats 100% ✅
Intuition\n- Calculate the sum of digits for each number and track the smallest sum.\n\n# Approach\n- Use a helper function to get the sum of digits.\n- Iterate
# Intuition\n- Calculate the sum of digits for each number and track the smallest sum.\n\n# Approach\n- Use a helper function to get the sum of digits.\n- Iterate through the array, updating the minimum digit sum.\n\n# Complexity\n- Time complexity:  \n  $$O(n \\cdot m)$$ \u2014 \\(n\\) is the number of elements, \\(m\\) is the average digits per number.\n  \n- Space complexity:  \n  $$O(1)$$ \u2014 Constant space for the minimum sum.\n\n# Code\n```java\nclass Solution {\n    private int sumOfDigits(int num) {\n        int sum = 0;\n        while (num > 0) {\n            sum += num % 10;\n            num /= 10;\n        }\n        return sum;\n    }\n    \n    public int minElement(int[] nums) {\n        int min = Integer.MAX_VALUE;\n        for (int num : nums) {\n            min = Math.min(min, sumOfDigits(num));\n        }\n        return min;\n    }\n}\n```\n\n# Upvote if you found this helpful! \uD83D\uDE0A
['Java']