easy solution | beats 100%
Intuition\nTo solve this problem, we need to identify the "special" elements in the array. A special element is defined as an element whose index (1-based) divi
# Intuition\nTo solve this problem, we need to identify the "special" elements in the array. A special element is defined as an element whose index (1-based) divides the length of the array without leaving a remainder. Once identified, we will compute the square of each special element and sum these squares to get the final result.\n\n# Approach\n1. **Identify Special Elements**:\n   - For each index $$ i $$ in the array, check if $$ n \\% (i+1) == 0 $$. This is because in the problem, $$ i $$ is 1-indexed, but array indexing in most programming languages (like C++) is 0-indexed. Therefore, we adjust by checking $$ n \\% (i+1) $$.\n2. **Compute Squares and Sum**:\n   - If the condition $$ n \\% (i+1) == 0 $$ holds true, compute the square of the element at that index and add it to the running sum.\n3. **Return the Result**:\n   - After iterating through the array, return the sum of the squares of all special elements.\n\n# Complexity\n- **Time complexity**: $$ O(n) $$\n  - We iterate through the array once to check each index and potentially add to the sum.\n- **Space complexity**: $$ O(1) $$\n  - We use a constant amount of extra space for the result variable.\n\n\n# Code\n```\nclass Solution {\npublic:\n    int sumOfSquares(vector<int>& nums) {\n        int ans = 0, n=nums.size() ;\n        for (int i=0; i<n; i++){\n            if (n % (i+1) == 0) ans += nums[i]*nums[i] ;\n        }\n        return ans ;\n    }\n};\n```
['Array', 'Enumeration', 'C++']