problem
solution
option 1 - hash tables
1 |
|
option 2 - vote
最多兩個數字出現頻率超過 n/3
1 | class Solution { |
analysis
- option 1 - hash table
- time complexity
O(n)
- space complexity
O(n)
- time complexity
- option 1 - vote
- time complexity
O(n)
- space complexity
O(1)
- time complexity