simple in java for beginner 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int sumOfBeauties(int[] nums) {
        
      int minOnRight[] = new int[nums.length];
      minOnRight[nums.length-1]=nums[nums.length-1];
      int maxOnLeft = nums[0];
      int n = nums.length;
      for(int i=n-1;i>0;i--)
      {
        minOnRight[i-1]= Math.min(minOnRight[i],nums[i-1]);
      }
      int beauty=0;
      for(int i=1;i<n-1;i++)
      {
        if(nums[i]>maxOnLeft && nums[i]<minOnRight[i+1])
         beauty+=2;
        else if(nums[i]>nums[i-1] && nums[i]<nums[i+1])
         beauty+=1;

        maxOnLeft=Math.max(nums[i],maxOnLeft);
      } 
      return beauty;
    }
}
```
['Java']