For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
Given an array of length N and an integer k. Choose an array of k elements from this array in any order. The sum of these elements is called k-sum.
Write a function to return the maximum k-sum.
Suppose the array selected is called old. Now randomly select another array of length k, call it old. The product sum of new and old is defined as $\sum_{i < len(new)}new[i]\times old[i]$. Find the maximum product sum.
Given an array of length N and an integer k. Choose an array of k elements from this array in any order. The sum of these elements is called k-sum.
Write a function to return the maximum k-sum.
Suppose the array selected is called old. Now randomly select another array of length k, call it old. The product sum of new and old is defined as $\sum_{i < len(new)}new[i]\times old[i]$. Find the maximum product sum.
Output