diff --git a/python/2778_sum_of_squares_of_special_elements.py b/python/2778_sum_of_squares_of_special_elements.py new file mode 100644 index 0000000..82d0205 --- /dev/null +++ b/python/2778_sum_of_squares_of_special_elements.py @@ -0,0 +1,4 @@ +class Solution: + def sumOfSquares(self, nums: List[int]) -> int: + n = len(nums) + return sum(x**2 for (i, x) in enumerate(nums) if n % (i+1) == 0)