上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: 代码:class MyQueue { // Push element x to the back of queue. Stack stack = new Stack(); Stack aux = new Stack(); public void push(int x) { ... 阅读全文
posted @ 2016-01-13 05:31 爱推理的骑士 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Two's complement of integer:https://zh.wikipedia.org/wiki/%E4%BA%8C%E8%A3%9C%E6%95%B8Bit Manipulation:https://docs.oracle.com/javase/tutorial/java/nut... 阅读全文
posted @ 2016-01-13 05:17 爱推理的骑士 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Functions of StringBuilder:代码:public class Solution { public List summaryRanges(int[] nums) { List list = new ArrayList(); if(nums.le... 阅读全文
posted @ 2016-01-13 04:45 爱推理的骑士 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 如何递归完成反转整个树。注意临时存储置换前的left node代码:/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNod... 阅读全文
posted @ 2016-01-12 08:41 爱推理的骑士 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Methods(functions) of Queue:offer(E):boolean --Insert E into QueuePoll(): E--Retrieve and removes the head of QueuePeek(): E--Retrieve but not remove ... 阅读全文
posted @ 2016-01-12 08:03 爱推理的骑士 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 几何知识,综合考虑可能出现的条件就能解决了。代码: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... 阅读全文
posted @ 2016-01-12 07:13 爱推理的骑士 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 代码:public class Solution { public boolean containsNearbyDuplicate(int[] nums, int k) { //int gap = nums.length; Map map = new HashMap... 阅读全文
posted @ 2016-01-12 06:48 爱推理的骑士 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 遍历数组找出有没有重复的元素 首先想到用一个数组记录出现的元素的个数代码:public class Solution { public boolean containsDuplicate(int[] nums) { if(nums.length == 0) return true... 阅读全文
posted @ 2016-01-12 05:42 爱推理的骑士 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Iteration:代码:/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; }... 阅读全文
posted @ 2016-01-11 13:17 爱推理的骑士 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 创建两个数组 分别记录两个字符串 各个位置字符出现的上一个位置 通过比较当前字符的上一个位置是否相同 判断是否同构比较坑爹的是 一开始以为只有字母 所以纠结于怎么找出字母来。。。代码如下:public class IsomorphicStrings { public static boolean ... 阅读全文
posted @ 2016-01-11 04:26 爱推理的骑士 阅读(95) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页