Class Solution

java.lang.Object
g1301_1400.s1390_four_divisors.Solution

public class Solution extends Object
1390 - Four Divisors.<p>Medium</p> <p>Given an integer array <code>nums</code>, return <em>the sum of divisors of the integers in that array that have exactly four divisors</em>. If there is no such integer in the array, return <code>0</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> nums = [21,4,7]</p> <p><strong>Output:</strong> 32</p> <p><strong>Explanation:</strong></p> <p>21 has 4 divisors: 1, 3, 7, 21</p> <p>4 has 3 divisors: 1, 2, 4</p> <p>7 has 2 divisors: 1, 7</p> <p>The answer is the sum of divisors of 21 only.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> nums = [21,21]</p> <p><strong>Output:</strong> 64</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> nums = [1,2,3,4,5]</p> <p><strong>Output:</strong> 0</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= nums.length <= 10<sup>4</sup></code></li> <li><code>1 <= nums[i] <= 10<sup>5</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • sumFourDivisors

      public int sumFourDivisors(int[] nums)