| { |
| "id": 2542, |
| "name": "average-value-of-even-numbers-that-are-divisible-by-three", |
| "difficulty": "Easy", |
| "link": "https://leetcode.com/problems/average-value-of-even-numbers-that-are-divisible-by-three/", |
| "date": "2022-10-23", |
| "task_description": "Given an integer array `nums` of **positive** integers, return _the average value of all even integers that are divisible by_ `3`. Note that the **average** of `n` elements is the **sum** of the `n` elements divided by `n` and **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 <= 1000` `1 <= nums[i] <= 1000`", |
| "test_case": [ |
| { |
| "label": "Example 1", |
| "input": "nums = [1,3,6,10,12,15]", |
| "output": "9 " |
| }, |
| { |
| "label": "Example 2", |
| "input": "nums = [1,2,4,7,10]", |
| "output": "0 " |
| } |
| ], |
| "constraints": [ |
| "1 <= nums.length <= 1000", |
| "1 <= nums[i] <= 1000" |
| ], |
| "python_template": "class Solution(object):\n def averageValue(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n ", |
| "java_template": "class Solution {\n public int averageValue(int[] nums) {\n \n }\n}", |
| "metadata": { |
| "func_name": "averageValue" |
| } |
| } |