Tap here to switch tabs
Problem
Submissions

Problem: Maximum Element-Sum of a Complete Subset of Indices

Try to solve the Maximum Element-Sum of a Complete Subset of Indices problem.

Statement

You are given an array of integers nums of length n, indexed from 11 to n.

A subset of indices is defined as complete if the product of any two chosen indices from the subset is a perfect square. That is, for every pair of indices i and j in the subset, the product iimesji imes j must be a perfect square. A subset containing a single index is always complete.

Return the maximum sum of elements in nums corresponding to a complete subset of indices.

Constraints:

  • 1≤n==1 \leq n == nums.length ≤104\leq 10^4

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Element-Sum of a Complete Subset of Indices

Try to solve the Maximum Element-Sum of a Complete Subset of Indices problem.

Statement

You are given an array of integers nums of length n, indexed from 11 to n.

A subset of indices is defined as complete if the product of any two chosen indices from the subset is a perfect square. That is, for every pair of indices i and j in the subset, the product iimesji imes j must be a perfect square. A subset containing a single index is always complete.

Return the maximum sum of elements in nums corresponding to a complete subset of indices.

Constraints:

  • 1≤n==1 \leq n == nums.length ≤104\leq 10^4

  • 1≤1 \leq nums[i] ≤109\leq 10^9