for beginners
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int ans(int &val){\n        int ans=0;\n        while(val!=0){\n            ans=ans+val%10;\n            val=val/10;\n        }\n        return ans;\n    }\n    int minElement(vector<int>& nums) {\n        vector<int>arr;\n        int val;\n        int n=nums.size();\n        for(int i=0; i<n; i++){\n            val=nums[i];\n            arr.push_back(ans(val));\n        }\n        sort(arr.begin(),arr.end());\n        return arr[0];\n    }\n};\n```
['C++']