2862. Maximum Element-Sum of a Complete Subset of Indices
You are given a 1**-indexed** array
nums
ofn
integers.A set of numbers is complete if the product of every pair of its elements is a perfect square.
For a subset of the indices set
{1, 2, ..., n}
represented as{i1, i2, ..., ik}
, we define its element-sum as:nums[i1] + nums[i2] + ... + nums[ik]
.Return the maximum element-sum of a complete subset of the indices set
{1, 2, ..., n}
.A perfect square is a number that can be expressed as the product of an integer by itself.
1 | class Solution { |