Common C# solution with a bit of Math
Intuition\n Describe your first thoughts on how to solve this problem. \nKind of the same as all of the other solutions, but keep in mind that everything betwee
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nKind of the same as all of the other solutions, but keep in mind that everything between n / 2 and n doesn\'t divide n by default.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nIterate to n / 2, add square of an element to the result if it meets the condition. Add square of the last element to the result cause n divides n.\n\n# Complexity\n- Time complexity: $$O(n/2)$$ which is $$O(n)$$, I know, but still...\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\npublic class Solution {\n    public int SumOfSquares(int[] nums)\n    {\n        int res = 0, n = nums.Length;\n        for (var i = 0; i < n / 2; i++)\n            if (n % (i + 1) == 0)\n                res += nums[i] * nums[i];\n        return res + nums[^1] * nums[^1];\n    }\n}\n```
['Math', 'C#']