3909. Compare Sums of Bitonic Parts
You are given a bitonic array
numsof lengthn.Split the array into two parts:
- Ascending part: from index 0 to the peak element (inclusive).
- Descending part: from the peak element to index
n - 1(inclusive).The peak element belongs to both parts.
Return:
- 0 if the sum of the ascending part is greater.
- 1 if the sum of the descending part is greater.
- -1 if both sums are equal.
Notes:
- A bitonic array is an array that is strictly increasing up to a single peak element and then strictly decreasing.
- An array is said to be strictly increasing if each element is strictly greater than its previous one (if exists).
- An array is said to be strictly decreasing if each element is strictly smaller than its previous one (if exists).
1 | class Solution { |