Given an integer array weight of size n, representing the weights of parcels placed in a row.
A shipment is defined as a contiguous subarray of parcels. A shipment is considered balanced if the weight of its last parcel is strictly less than the maximum parcel weight within that shipment.
Return the maximum number of disjoint balanced shipments that can be formed from weight.
Constraints:
n
weight[i]
Given an integer array weight of size n, representing the weights of parcels placed in a row.
A shipment is defined as a contiguous subarray of parcels. A shipment is considered balanced if the weight of its last parcel is strictly less than the maximum parcel weight within that shipment.
Return the maximum number of disjoint balanced shipments that can be formed from weight.
Constraints:
n
weight[i]