C++✅✅| 100% beats | Simplest approach🚀🚀
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
```cpp []
class Solution {
public:
    int sumOfSquares(vector<int>& nums) {
        int ans = 0, n = nums.size();
        for(int i = 0; i < n; i++) {
            if(n % (i + 1) == 0)
                ans += (nums[i] * nums[i]);
        }
        return ans;
    }
};
```
['Array', 'Enumeration', 'C++']