|
| 1 | +<h2><a href="https://leetcode.com/problems/majority-element-ii/">229. Majority Element II</a></h2><h3>Medium</h3><hr><div><p>Given an integer array of size <code>n</code>, find all elements that appear more than <code>⌊ n/3 ⌋</code> times.</p> |
| 2 | + |
| 3 | +<p> </p> |
| 4 | +<p><strong>Example 1:</strong></p> |
| 5 | + |
| 6 | +<pre><strong>Input:</strong> nums = [3,2,3] |
| 7 | +<strong>Output:</strong> [3] |
| 8 | +</pre> |
| 9 | + |
| 10 | +<p><strong>Example 2:</strong></p> |
| 11 | + |
| 12 | +<pre><strong>Input:</strong> nums = [1] |
| 13 | +<strong>Output:</strong> [1] |
| 14 | +</pre> |
| 15 | + |
| 16 | +<p><strong>Example 3:</strong></p> |
| 17 | + |
| 18 | +<pre><strong>Input:</strong> nums = [1,2] |
| 19 | +<strong>Output:</strong> [1,2] |
| 20 | +</pre> |
| 21 | + |
| 22 | +<p> </p> |
| 23 | +<p><strong>Constraints:</strong></p> |
| 24 | + |
| 25 | +<ul> |
| 26 | + <li><code>1 <= nums.length <= 5 * 10<sup>4</sup></code></li> |
| 27 | + <li><code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code></li> |
| 28 | +</ul> |
| 29 | + |
| 30 | +<p> </p> |
| 31 | +<p><strong>Follow up:</strong> Could you solve the problem in linear time and in <code>O(1)</code> space?</p> |
| 32 | +</div> |
0 commit comments