Optimized simple java solution - beats 100%🔥
Complexity
Time complexity: O(N)

Space complexity: O(1)
Code
# 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 sum = 0;

        for (int i = 0; i < nums.length; i++) {
            if (nums.length % (i + 1) == 0) sum += nums[i] * nums[i];
        }

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