美文网首页
2018-05-16

2018-05-16

作者: hainingwyx | 来源:发表于2018-05-16 10:54 被阅读16次
    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
            
        }
        
        
    
    }
    
    
    
    
    

    相关文章

      网友评论

          本文标题:2018-05-16

          本文链接:https://www.haomeiwen.com/subject/gqqpdftx.html