Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c35bd58

Browse files
Create README - LeetHub
1 parent e572779 commit c35bd58

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎169-majority-element/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<h2><a href="https://leetcode.com/problems/majority-element/">169. Majority Element</a></h2><h3>Easy</h3><hr><div><p>Given an array <code>nums</code> of size <code>n</code>, return <em>the majority element</em>.</p>
2+
3+
<p>The majority element is the element that appears more than <code>⌊n / 2⌋</code> times. You may assume that the majority element always exists in the array.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong>Example 1:</strong></p>
7+
<pre><strong>Input:</strong> nums = [3,2,3]
8+
<strong>Output:</strong> 3
9+
</pre><p><strong>Example 2:</strong></p>
10+
<pre><strong>Input:</strong> nums = [2,2,1,1,1,2,2]
11+
<strong>Output:</strong> 2
12+
</pre>
13+
<p>&nbsp;</p>
14+
<p><strong>Constraints:</strong></p>
15+
16+
<ul>
17+
<li><code>n == nums.length</code></li>
18+
<li><code>1 &lt;= n &lt;= 5 * 10<sup>4</sup></code></li>
19+
<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
20+
</ul>
21+
22+
<p>&nbsp;</p>
23+
<strong>Follow-up:</strong> Could you solve the problem in linear time and in <code>O(1)</code> space?</div>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /