My LeetCode grinding. Trying to do a problem a day.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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