Рет қаралды 12,338
Majority element 2 :
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.
Follow-up: Could you solve the problem in linear time and in O(1) space?
Majority element 1 )
Given an array nums of size n, return the majority element.
The majority element is the element that appears more than ⌊n / 2⌋ times.