[Python3] Brute-Force - Detailed Explanation
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n1. Initialization:\n\n-
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n**1. Initialization:**\n\n- `min_num` is initialized to `float("inf")` to store the minimum sum found so far.\n\n**2. Iteration:**\n\n- The loop iterates over each number `num` in the `nums` list.\n\n**3. Digit Sum Calculation:**\n\n- `new_num` is calculated by converting the number `num` to a string, iterating over each digit, converting the digit to an integer, and summing the digits.\n\n**4. Minimum Update:**\n\n- `min_num` is updated to the minimum of its current value and `new_num`.\n\n**5. Return Value:**\n\n- The final value of `min_num` is returned, which represents the minimum sum of digits among all numbers in `nums`.\n\n**Explanation:**\n\nThe code effectively calculates the minimum sum of digits for each number by converting the numbers to strings, iterating over their digits, and summing the digits. The `min_num` variable keeps track of the minimum sum found so far, ensuring that the function returns the correct result.\n\n# Complexity\n- Time complexity: $$O(N * S)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(S)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def minElement(self, nums: List[int]) -> int:\n        min_num = float("inf")\n        for num in nums:\n            new_num = sum(int(d) for d in str(num))\n            min_num = min(min_num, new_num)\n        return min_num\n```
['Array', 'String', 'Python3']