[JavaScript] 2778. Sum of Squares of Special Elements
Q1 - see below\n- Q2 - https://leetcode.com/problems/maximum-beauty-of-an-array-after-applying-operation/solutions/3773661/javascript-2779-maximum-beauty-of-an-
- Q1 - see below\n- Q2 - https://leetcode.com/problems/maximum-beauty-of-an-array-after-applying-operation/solutions/3773661/javascript-2779-maximum-beauty-of-an-array-after-applying-operation/\n- Q3 - https://leetcode.com/problems/minimum-index-of-a-valid-split/solutions/3771906/javascript-2780-minimum-index-of-a-valid-split/\n\n\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nvar sumOfSquares = function (a) {\n  let n = a.length\n\n  let s = 0\n  for (let i = 1; i <= n; i++) {\n    if (n % i === 0) {\n      s += a[i - 1] * a[i - 1]\n    }\n  }\n  return s\n}\n\n```
['JavaScript']