Skip to content

Commit

Permalink
feat(leetcode): add No.2778
Browse files Browse the repository at this point in the history
  • Loading branch information
mickey0524 committed Jul 18, 2023
1 parent 4f9f93c commit 4db281f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions 2778.Sum-of-Squares-of-Special-Elements.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// https://leetcode.com/problems/sum-of-squares-of-special-elements/
// algorithms
// Easy (78.64%)
// Total Accepted: 24.3K
// Total Submissions: 30.9K

class Solution {

public int sumOfSquares(int[] nums) {
int len = nums.length;
int res = 0;

for (int i = 0; i < len; i++) {
if (len % (i + 1) == 0) {
res += nums[i] * nums[i];
}
}

return res;
}

}

0 comments on commit 4db281f

Please sign in to comment.