Simple and Straigth-forward Approach
ApproachWe will first check for the special element through a boolean method sqrPossible() i.e.,
Is n divisible by i (n % i == 0) ?If sqrPossible() returns true

<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->
We will first check for the special element through a boolean method `sqrPossible()` i.e.,
Is `n` divisible by i (`n % i == 0`) ?

If `sqrPossible()` returns true only then we will, further, find the square of that special element and will add it in `sum` variable and then will return that `sum` when our pointer reached the end.

# Complexity
- Time complexity: O (N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O (1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int sumOfSquares(int[] nums) {
        int n = nums.length;
        int sum = 0;
        for(int i = 0; i < n; i++)
        {
            // Since, our array is 1-indexed therefore, we have to pass i + 1 in the method
            if(sqrPossible(i + 1, n))   
            {
                sum += nums[i] * nums[i];
            }
        }
        return sum;
    }
    // check for the division of n and i i.e for special array.
    private boolean sqrPossible(int idx, int n)
    {
        if(n % idx == 0)
        return true;

        return false;
    }
}
```
['Java']