Beats : 95.20% | O(n) | one line | easy python solution
Intuition\nWe want to calculate the sum of squares of numbers in the input list at positions where the length of the input list is divisible by the 1-based inde
# Intuition\nWe want to calculate the sum of squares of numbers in the input list at positions where the length of the input list is divisible by the 1-based index.\n\n# Approach\n1. Initialize an empty list `squares` to store the squares of selected numbers.\n2. Use a list comprehension to iterate through the input list `nums` and select the numbers at positions where len(nums) is divisible by (index + 1).\n3. Calculate the square of each selected number and add it to the `squares` list.\n4. Finally, return the sum of the values in the `squares` list.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution:\n    def sumOfSquares(self, nums: List[int]) -> int:\n        \n        return sum([num*num for index, num in enumerate(nums) if len(nums) % (index+1) == 0])\n```
['Python3']