# Problem Definition

## Description

Given an array of size `n`, find the majority element. The majority element is the element that appears more than `floor(n/2)` times.

You may assume that the array is non-empty and the majority element always exist in the array.

**Example:**

```plaintext
Input : [2, 1, 2]
Return : 2 which occurs 2 times which is greater than 3/2.
```

## Notes

1. [Geeks for Geeks post](https://www.geeksforgeeks.org/majority-element/)
1. [LeetCode discussion - Java solutions (sorting, hashmap, moore voting, bit manipulation)](https://leetcode.com/problems/majority-element/discuss/51611/Java-solutions-(sorting-hashmap-moore-voting-bit-manipulation).)
1. [LeetCode discussion - O(n) time O(1) space fastest solution]("https://leetcode.com/problems/majority-element/discuss/51613/O(n)-time-O(1)-space-fastest-solution")
1. [Moore voting algorithm](https://www.cs.utexas.edu/~moore/best-ideas/mjrty/index.html)