首页 > 其他 > 详细

217 Contains Duplicate (Array)

时间:2018-07-27 00:50:07      阅读:165      评论:0      收藏:0      [点我收藏+]
 1 class Solution {
 2     public boolean containsDuplicate(int[] nums) {
 3         HashMap<Integer, Integer> m = new HashMap<Integer, Integer>();
 4         for(int i = 0; i < nums.length; i++) {
 5             if (m.containsKey(nums[i])) {
 6                 return true;
 7             }else {
 8                 m.put(nums[i], 1);
 9             }
10         }
11         return false;
12     }
13 }

 

217 Contains Duplicate (Array)

原文:https://www.cnblogs.com/goPanama/p/9375119.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!