Class Solution
java.lang.Object
g2401_2500.s2455_average_value_of_even_numbers_that_are_divisible_by_three.Solution
2455 - Average Value of Even Numbers That Are Divisible by Three.<p>Easy</p>
<p>Given an integer array <code>nums</code> of <strong>positive</strong> integers, return <em>the average value of all even integers that are divisible by</em> <code>3</code><em>.</em></p>
<p>Note that the <strong>average</strong> of <code>n</code> elements is the <strong>sum</strong> of the <code>n</code> elements divided by <code>n</code> and <strong>rounded down</strong> to the nearest integer.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> nums = [1,3,6,10,12,15]</p>
<p><strong>Output:</strong> 9</p>
<p><strong>Explanation:</strong> 6 and 12 are even numbers that are divisible by 3. (6 + 12) / 2 = 9.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> nums = [1,2,4,7,10]</p>
<p><strong>Output:</strong> 0</p>
<p><strong>Explanation:</strong> There is no single number that satisfies the requirement, so return 0.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= nums.length <= 1000</code></li>
<li><code>1 <= nums[i] <= 1000</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
averageValue
public int averageValue(int[] nums)
-