Class Solution
- java.lang.Object
-
- g2401_2500.s2455_average_value_of_even_numbers_that_are_divisible_by_three.Solution
-
public class Solution extends Object
2455 - Average Value of Even Numbers That Are Divisible by Three.Easy
Given an integer array
numsof positive integers, return the average value of all even integers that are divisible by3.Note that the average of
nelements is the sum of thenelements divided bynand rounded down to the nearest integer.Example 1:
Input: nums = [1,3,6,10,12,15]
Output: 9
Explanation: 6 and 12 are even numbers that are divisible by 3. (6 + 12) / 2 = 9.
Example 2:
Input: nums = [1,2,4,7,10]
Output: 0
Explanation: There is no single number that satisfies the requirement, so return 0.
Constraints:
1 <= nums.length <= 10001 <= nums[i] <= 1000
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaverageValue(int[] nums)
-