Java easy solution with min-heap and max-heap.
\nclass Solution {\n    public int sumOfBeauties(int[] nums) {\n        int count = 0;\n        int n = nums.length;\n        \n        PriorityQueue<Integer> m
``` \nclass Solution {\n    public int sumOfBeauties(int[] nums) {\n        int count = 0;\n        int n = nums.length;\n        \n        PriorityQueue<Integer> minHeap = new PriorityQueue<>();\n        PriorityQueue<Integer> maxHeap = new PriorityQueue<>(new Comparator<>(){\n            public int compare(Integer cur, Integer next) {\n                return next - cur;\n            }\n        });\n        \n        maxHeap.offer(nums[0]);\n        for(int i = 2; i < n; i++) {\n            minHeap.offer(nums[i]);\n        }\n        \n        for(int i = 1; i < n-1; i++) {\n            if(nums[i-1] < nums[i] && nums[i] < nums[i+1]) {\n                if(nums[i] > maxHeap.peek() && nums[i] < minHeap.peek()) {\n                    count += 2;\n                } else {\n                    count += 1;\n                }\n            }\n            \n            maxHeap.offer(nums[i]);\n            minHeap.poll();\n        }\n        \n        return count;\n    }\n} \n```
[]