难度:medium

Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.

思路:找到给定的array里面,出现次数超过总长度 1/3 的element。用hashtable解决,有点不明白为什么是medium难度。


leetcode 229[medium]--- Majority Element II




相关文章:

  • 2021-11-21
  • 2021-05-23
  • 2021-08-07
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
猜你喜欢
  • 2021-05-08
  • 2021-05-19
  • 2021-06-04
  • 2022-01-04
  • 2021-08-10
  • 2021-09-25
相关资源
相似解决方案