Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2681. Power of Heroes
Compute the sum over all non-empty subsets of nums of (max(subset)^2 * min(subset)) modulo 1e9+7. With n up to 1e5 you must avoid enumerating subsets and instead use sorting plus combinatorial counting (powers of two) to accumulate each element’s contribution as max/min efficiently.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.