easy cpp code || using heaps
everytime we just need to find max element on our leftside and min element on our right side, and we can easily find the answer :) \n\nclass Solution {\npublic:
everytime we just need to find max element on our leftside and min element on our right side, and we can easily find the answer :) \n```\nclass Solution {\npublic:\n    int sumOfBeauties(vector<int>& nums) {\n        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> minh;\n        for(int i=0;i<nums.size();i++){\n            minh.push({nums[i],i});\n        }\n        int a=INT_MIN,ans=0;\n        for(int i=1;i<nums.size()-1;i++){\n            a=max(a,nums[i-1]);\n            while(minh.top().second<=i) minh.pop();\n            if(a<nums[i]&&nums[i]<minh.top().first) ans+=2;\n            else if(nums[i]>nums[i-1]&&nums[i]<nums[i+1]) ans++;\n        }\n        return ans;\n    }\n};\n```
[]