mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
批量更新数据
This commit is contained in:
@@ -1,37 +1,37 @@
|
||||
<p>Given an integer array <code>nums</code>, return <em>the most frequent even element</em>.</p>
|
||||
|
||||
<p>If there is a tie, return the <strong>smallest</strong> one. If there is no such element, return <code>-1</code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [0,1,2,2,4,4,1]
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong>
|
||||
The even elements are 0, 2, and 4. Of these, 2 and 4 appear the most.
|
||||
We return the smallest one, which is 2.</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [4,4,4,9,2,4]
|
||||
<strong>Output:</strong> 4
|
||||
<strong>Explanation:</strong> 4 is the even element appears the most.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [29,47,21,41,13,37,25,7]
|
||||
<strong>Output:</strong> -1
|
||||
<strong>Explanation:</strong> There is no even element.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 2000</code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>5</sup></code></li>
|
||||
</ul>
|
||||
<p>Given an integer array <code>nums</code>, return <em>the most frequent even element</em>.</p>
|
||||
|
||||
<p>If there is a tie, return the <strong>smallest</strong> one. If there is no such element, return <code>-1</code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [0,1,2,2,4,4,1]
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong>
|
||||
The even elements are 0, 2, and 4. Of these, 2 and 4 appear the most.
|
||||
We return the smallest one, which is 2.</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [4,4,4,9,2,4]
|
||||
<strong>Output:</strong> 4
|
||||
<strong>Explanation:</strong> 4 is the even element appears the most.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [29,47,21,41,13,37,25,7]
|
||||
<strong>Output:</strong> -1
|
||||
<strong>Explanation:</strong> There is no even element.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 2000</code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>5</sup></code></li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user