Search⌘ K
AI Features

Solution: Sum of Squares of Special Elements

Explore how to identify special elements in an array by their positions that evenly divide the array length, then calculate the sum of their squares. This lesson helps you understand indexing-based conditions and apply efficient iteration and arithmetic operations to solve math-related coding problems.

Statement

You are given a 11-indexed integer array nums of length n.

An element nums[i] is considered special if i divides n evenly, meaning n % i == 0.

Return the sum of the squares of all special elements in nums.

Constraints:

  • 11 \leq nums.length == n ...