package onlineinterview;
import java.util.HashSet;
public class Solution {
public static int computeLiuCun(int[] firstdayID, int[] anydayID) {
int result = 0;
HashSet<Integer> s1 = new HashSet<Integer>();
for(int i=0;i<firstdayID.length;i++) {
s1.add(firstdayID[i]);
}
for(int i=0;i<anydayID.length;i++) {
if(s1.contains(anydayID[i])) {
result++;
}
}
return result;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
网友评论