Given a nums, calculate the total sum of the beauty of nums[i] for all indices i satisfying i nums.length
For each index i in the range i nums.length nums[i] is defined as:
j with j i and every index k with i k nums.length nums[j] nums[i] nums[k] holds true.
nums[i - 1] nums[i] nums[i + 1] holds true.
Return the sum of the beauty of nums[i] for all valid indices i.
Constraints:
nums.length
nums[i]
Given a nums, calculate the total sum of the beauty of nums[i] for all indices i satisfying i nums.length
For each index i in the range i nums.length nums[i] is defined as:
j with j i and every index k with i k nums.length nums[j] nums[i] nums[k] holds true.
nums[i - 1] nums[i] nums[i + 1] holds true.
Return the sum of the beauty of nums[i] for all valid indices i.
Constraints:
nums.length
nums[i]