2160.cpp (245B)
1 class Solution { 2 public: 3 int minimumSum(int num) { 4 vector<int> arr = {num % 10, num / 10 % 10, num / 100 % 10, num / 1000 % 10}; 5 sort(begin(arr), end(arr)); 6 return (arr[0] + arr[1]) * 10 + arr[2] + arr[3]; 7 } 8 };