My LeetCode grinding. Trying to do a problem a day.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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