Finding Minimum Element After Replacement With Digit Sum using Dart GOAT 🐐 language.
Intuition\n- From the given description it is clear that, all we need to do is find the sum of all digits in the given list and return the minimum of it.\n\n# A
# Intuition\n- **From the given description it is clear that, all we need to do is find the sum of all digits in the given list and return the minimum of it.**\n\n# Approach\n1. First of all I used for loop to iterate through the given argument list.\n2. In each iteration I converted each iterated value to String and used another for loop to iterate through that converted value. But before that I created a variable to store the digits sum of iterated number. In each iteration I added that iterated value to the sum variable. After that loop ends I replaced the value of the iterated value with sum value.\n3. At the end I sorted the list using sort() method and returned the minimum value of the list.\n\n# Code\n```dart []\nclass Solution {\n int minElement(List<int> nums) {\n  for(int i = 0; i < nums.length; i++){\n    String conv = nums[i].toString();\n    int sum = 0;\n    for(int j = 0; j < conv.length; j++){\n      sum+=int.parse(conv[j]);\n    }\n    nums[i] = sum;\n  }\n\n  nums.sort((a, b) => a.compareTo(b));\n  return nums.first;\n}\n}\n```
['Array', 'Math', 'Dart']