编程语言
首页 > 编程语言> > LeetCode-961 N-Repeated Element in Size 2N Array Solution (with Java)

LeetCode-961 N-Repeated Element in Size 2N Array Solution (with Java)

作者:互联网

1. Description: 

Notes:

2. Examples:

3.Solutions:

 1 /**
 2  * Created by sheepcore on 2019-02-24
 3  */
 4 class Solution {
 5     public int repeatedNTimes(int[] A) {
 6         int[] count = new int[10000];
 7         for(int i=0;i<A.length;i++)
 8             if(count[A[i]]++ == 1)
 9                 return A[i];
10             return -1;
11         }
12 }

 

标签:02,repeatedNTimes,961,int,Solution,sheepcore,Java
来源: https://www.cnblogs.com/sheepcore/p/12395999.html