Practice Find the Sum of Subsequence Powers
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given an integer array nums of length n, and a positive integer k. The power of a subsequence is defined as the minimum absolute difference between any two elements in the subsequence. Return the sum of powers of all subsequences of nums which have length equal to k. Since the answer may be large, return it modulo 10^9 + 7.
Source: Find the Sum of Subsequence Powers on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [1,2,3,4], k = 3
4
# Example 2
nums = [2,2], k = 2
0
# Example 3
nums = [4,3,-1], k = 2
10
Constraints
Related LeetCode Problems
Practice more problems similar to Find the Sum of Subsequence Powers.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.