摘要:
如何递归完成反转整个树。注意临时存储置换前的left node代码:/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNod... 阅读全文
摘要:
Methods(functions) of Queue:offer(E):boolean --Insert E into QueuePoll(): E--Retrieve and removes the head of QueuePeek(): E--Retrieve but not remove ... 阅读全文
摘要:
几何知识,综合考虑可能出现的条件就能解决了。代码:public class Solution { public int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) { int x1, y1... 阅读全文
摘要:
代码:public class Solution { public boolean containsNearbyDuplicate(int[] nums, int k) { //int gap = nums.length; Map map = new HashMap... 阅读全文
摘要:
遍历数组找出有没有重复的元素 首先想到用一个数组记录出现的元素的个数代码:public class Solution { public boolean containsDuplicate(int[] nums) { if(nums.length == 0) return true... 阅读全文