Easy to understand || c++ || easy and concise solution || using sets
\nclass Solution {\npublic:\n    int sumOfBeauties(vector<int>& nums) {\n        multiset<int> a,b;\n        for(auto x:nums)a.insert(x);\n        a.erase(a.fin
```\nclass Solution {\npublic:\n    int sumOfBeauties(vector<int>& nums) {\n        multiset<int> a,b;\n        for(auto x:nums)a.insert(x);\n        a.erase(a.find(nums[0]));\n        int c=0;\n        for(int i=1;i<nums.size()-1;i++)\n        {\n            b.insert(nums[i-1]);\n            a.erase(a.find(nums[i]));\n            if(*prev(b.end())<nums[i] and *(a.begin())>nums[i])c+=2;\n            else if(nums[i-1]<nums[i] and nums[i]<nums[i+1])c+=1;\n        }\n        return c;    \n    }\n};\n```
[]