2862. Maximum Element-Sum of a Complete Subset of Indices
You are given a 1-indexed array nums. Your task is to select a complete subset from nums where every pair of selected indices multiplied is a perfect square,. i. e. if you select ai and aj, i * j must be a perfect square. Return the sum of the complete subset with the maximum sum. Example 1: Input: nums = [8,7,3,5,7,2,4,9] Output: 16 Explanation: We select elements at indices 2 and 8 and 2
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start