solve majority element