直接上代码,利用map解决 import java.util.*; public class Solution { public int MoreThanHalfNum_Solution(int [] array) { Map<Integer,Integer> map = new HashMap<>(); int count = 0; //遍历数组,将数组的值作为key for(int num : array){ //判断map中是否包含该key if...