Practice Find Sum of Array Product of Magical Sequences
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Find Sum of Array Product of Magical Sequences
Problem Statement
Consider all ordered sequences seq of length m with indices from 0 through nums.length - 1; repeated indices are allowed. A sequence is magical when the sum of 2^seq[i] over its entries has exactly k set bits in binary. Its contribution is the product of nums[seq[i]] over all entries. Return the sum of contributions of all magical sequences modulo 10^9 + 7.
Source: Find Sum of Array Product of Magical Sequences on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
m = 5, k = 5, nums = [1,10,100,10000,1000000]
991600007
# Example 2
m = 2, k = 2, nums = [5,4,3,2,1]
170
# Example 3
m = 1, k = 1, nums = [28]
28
Constraints
Related LeetCode Problems
Practice more problems similar to Find Sum of Array Product of Magical Sequences.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.