Solve 2778. Sum of Squares of Special Elements
This commit is contained in:
parent
20757a2bf2
commit
59064dd981
4
python/2778_sum_of_squares_of_special_elements.py
Normal file
4
python/2778_sum_of_squares_of_special_elements.py
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user