[JAVA] easiest solution 100% faster
Intuition\nIterate over the elements of the array and check if the length of the array is divisible by the index plus one (n % (i + 1) == 0). If true, square of
# Intuition\nIterate over the elements of the array and check if the length of the array is divisible by the index plus one (n % (i + 1) == 0). If true, square of the number at the current position is added to sum.\n\n# Approach\nVariable sum is initialized.\nFor each iteration, we checks if n % (i + 1) == 0 If this condition is true, it means that the current position (i) in the array should be considered for calculating the sum of squares. The code then adds the square of the number at the current position (nums[i] * nums[i]) to sum.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(N)\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```\nclass Solution {\n    public int sumOfSquares(int[] nums) {\n        int sum = 0;\n        for(int i = 0; i < nums.length; i ++) {\n            if(nums.length % (i + 1) == 0)\n            sum += nums[i] * nums[i];\n        }\n        return sum;\n    }\n}\n```\n# PLEASE UPVOTE IF IT WAS HELPFULL
['Array', 'Simulation', 'Java']