【leetcode】961. N-Repeated Element in Size 2N Array

class Solution {
    public int repeatedNTimes(int[] A) {
        int[] count = new int[10000];
        for (int i : A) {
            if (count[i]++ == 1) {
                return i;
            }
        }
            return 0;
    }
}

猜你喜欢

转载自blog.csdn.net/Art1st_D/article/details/89408058