leetcode刷题 java总结
写在前
本文章主要用来记录 刷题过程中java和c++的不同
数学函数
int minn= Integer.MAX_VALUE;
Math.max();
常用类(stl)
mapMap<Character,Character> mp = new HashMap<Character,Character>(){{put(')','(');put(']','[');put('}','{');}};mp.get(c) //取值哈希表HashMap<Integer,Integer> mp = new HashMap<Integer,Integer>();mp.containsKey(x) //是否存在xmp.put(nums[i],i); //插入mp.get(x) //取值栈Stack<Character> stk = new Stack<Character>();stk.isEmpty()stk.peek() stk.pop() stk.isEmpty()
返回值
return new int[0]; //返回空数组
return new int[] {a,b}; 返回数组