![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hashset
ZoJane
生不带来,死不带走。
展开
-
leetcode1002查找常用字符(Java)(hashmap)
class Solution { public List<String> commonChars(String[] A) { Map<Character,Integer> map=new HashMap<>(); for(char c:A[0].toCharArray()){ map.put(...原创 2019-04-03 22:59:58 · 327 阅读 · 0 评论 -
JAVA——哈希表
哈希表的定义1.哈希表定义:Map<String, Integer> counts = new HashMap(); 创建特定的hash表:Map<Integer,Integer>counts=new HashMap<Integer, Integer>(); 左边的是key右边的是value2.创建单个字符的键值对:Map<Char...原创 2019-03-31 11:34:13 · 374 阅读 · 0 评论 -
leetcode202快乐数(JAVA)(hashset)
class Solution { public boolean isHappy(int n) { if(n==1||n==-1) return true; HashSet<Integer>h=new HashSet<Integer>(); int m=0...原创 2019-03-31 23:00:13 · 304 阅读 · 0 评论 -
leetcode.136只出现一次的数字(JAVA)(hashmap)
class Solution { public int singleNumber(int[] nums) { Map<Integer,Integer>counts=new HashMap<Integer, Integer>(); for(int num:nums) { if(counts....原创 2019-03-28 21:52:53 · 314 阅读 · 0 评论