Easy Explanation
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nInitialization:\n\nStart by initializing a variable ans to 0. This variab
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n**Initialization:**\n\nStart by initializing a variable ans to 0. This variable will hold the cumulative sum of the squares of selected elements from the array.\n\n**Iterate Through Array:**\n\nLoop through each element in the array using an index i from 0 to nums.length - 1.\n\n**Check Divisibility:**\n\nFor each index i, compute i + 1 and check if nums.length % (i + 1) == 0. This checks whether i + 1 is a divisor of the length of the array.\n\n**Update Sum:**\n\nIf the condition is true, it means that the position (index i) should contribute to the final sum. Compute the square of nums[i] and add it to ans.\n\n**Return Result:**\n\nAfter the loop completes, return the value of ans, which contains the sum of the squares of the selected elements.\n\n# Complexity\n**Time Complexity:** O(n)\n**Space Complexity:** O(1)\n\n# Code\n```java []\nclass Solution {\n    public int sumOfSquares(int[] nums) {\n        int ans = 0;\n        for(int i = 0 ; i < nums.length ; i++){\n            if(nums.length%(i+1)==0){\n                ans = ans + (nums[i]*nums[i]);\n            }\n        }\n        return ans;\n    }\n}\n```
['Java']