Product of Subset Maxima
Updated
Problem 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 Online Assessment questions
- 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
- Detect a Cycle in Directed Hate RelationshipsOA · Seen Aug 2023
- Reverse First K Characters in Every 2K BlockOA · Seen Aug 2023
- Robo Data Sharing DirectionOA · Seen Jul 2023
- Capital Gains Tax from TradesOA · Seen Feb 2021
- K-th Character in an Infinite StringOA · Seen Aug 2020
Similar questions at other companies
- Sum of Pipeline Response TimesBloomberg LP · OABloomberg LP interview questions
- Capping Portfolio WeightsCapstone Investment Advisors · OA
- Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
- Macaron Order PriceOpenAI · OAOpenAI interview questions
- Get Triplet CountIBM · OAIBM interview questions
- Linear InterpolatorTwo Sigma · OATwo Sigma interview questions
- Count Reverse-Digit PairsVisa · OAVisa interview questions
- Get Triplet CountPoint72 · OAPoint72 interview questions
- Stable Robot ConfigurationsAmazon · OA
- REST API: Energy BarRippling · OARippling interview questions