Problem · Array
Product of Subset Maxima
Learn this problemProblem statement
Given an array values of positive integers, consider every non-empty subset of array indices. The value of a subset is the maximum array value selected by that subset.
Return the product of the values of all non-empty subsets, modulo 10^9 + 7.
Two equal values at different indices are still distinct selectable elements.
Function
productOfSubsetMaxima(values: int[]) → intExamples
Example 1
values = [1,2,3]return = 324The seven non-empty subsets have maxima 1, 2, 3, 2, 3, 3, 3. Their product is 324.
Example 2
values = [1,1,1,1]return = 1Every non-empty subset has maximum value 1.
Constraints
values.length >= 1.- Every element of
valuesis positive.
More Arcesium problems
- Ordered Payload ReleaseONSITE INTERVIEW · Seen Jul 2026
- Decode Numeric StringONSITE INTERVIEW · Seen Jun 2026
- Tree Ancestor QueriesONSITE INTERVIEW · Seen Jun 2026
- City Infection NumberOA · Seen Jul 2025
- Minimum Tunnel Crossing TimeOA · Seen Jul 2025
- Reconstruct the Root StreamOA · Seen Jul 2025
- Add DigitsOA · Seen Aug 2023
- Binary Tree Maximum Path SumOA · Seen Aug 2023