My LeetCode grinding. Trying to do a problem a day.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

problem.txt 312B

1234567891011121314
  1. Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.
  2. You may assume that the array is non-empty and the majority element always exist in the array.
  3. Example 1:
  4. Input: [3,2,3]
  5. Output: 3
  6. Example 2:
  7. Input: [2,2,1,1,1,2,2]
  8. Output: 2