Problem · Array
Find Maximum Number of Balanced Combinations
Learn this problemProblem statement
Given an array, the valid combinations are:
- [3]
- [6]
- [3]
- [3, 6, 3]
- [6, 3]
- [3, 6]
A combination is considered balanced if the last element is not the largest value in that combination. For example, [3, 6, 3] is balanced because the last element (3) is not larger than the others.
Your task is to find the maximum number of balanced combinations.
A possible custom case you can use could be - input = [99,25,69,28,32] output = 8
Function
findMaxBalancedCombinations(arr: int[]) → intExamples
Example 1
arr = [3, 6, 3]return = 2All possible combinations -
[3]
[6]
[3]
[3, 6, 3]
[6, 3]
[3, 6]
Balanced if the last element in the combination is NOT the greatest value.
Valid combinations -
[3, 6, 3] --> 3 is not the greatest
[6, 3] --> 3 is not the greatest
Constraints
~More Amazon problems
- Resolve Task DependenciesONSITE INTERVIEW · Seen Jul 2026
- Shortest Distance on a Circular Bus RouteOA · Seen Jul 2026
- Longest Increasing Subsequence With Bounded Adjacent DifferenceONSITE INTERVIEW · Seen Jul 2026
- Search in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Jul 2026
- Sliding Window MaximumONSITE INTERVIEW · Seen Jul 2026
- Merge IntervalsOA · Seen Jul 2026
- Sort Bug Report FrequenciesOA · Seen Jul 2026
- Drone Delivery RouteOA · Seen Jul 2026