Java Solution || Easy to Understand || Beats 100%
Intuition\n Describe your first thoughts on how to solve this problem. \nWe need to find the sum of squares of special numbers. A special number is one whose in
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe need to find the sum of squares of special numbers. A special number is one whose index divides the length of the array n perfectly.\nIf i is the index of the array in a for loop then a special number is one which n%i==0.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nWe ran a for loop on the array checking the special number condition if the element is a special number then we store its square in the ans variable.\n\n\n# Code\n```\nclass Solution {\n    public int sumOfSquares(int[] nums) {\n        int n = nums.length;\n        int ans = 0;\n        for(int i=0;i<n;i++){\n            if(n%(i+1)==0){\n                ans += nums[i] * nums[i];\n            }\n        }\n        return ans;\n    }\n}\n```\n\n![oie_CksRiTNvbciG.jpg](https://assets.leetcode.com/users/images/d72a908a-aecd-4ad4-806f-09e00ea36116_1689618258.1878498.jpeg)
['Java']