上一页 1 2 3 4 5 6 ··· 17 下一页
Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2. Your algorithm s Read More
posted @ 2017-02-17 20:36 再见,少年 Views(138) Comments(0) Diggs(0) Edit
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You a Read More
posted @ 2017-02-17 18:40 再见,少年 Views(375) Comments(0) Diggs(0) Edit
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: Approach #3 (Dyn Read More
posted @ 2017-01-08 09:41 再见,少年 Views(1048) Comments(1) Diggs(0) Edit
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng Read More
posted @ 2016-12-03 22:21 再见,少年 Views(152) Comments(0) Diggs(0) Edit
虚拟机每次方法的调用和返回都伴随着栈帧的入栈和出栈,而每个栈帧都包含一个指向运行时常量池中该栈帧所属方法的引用(表明该栈帧执行的是哪个方法),持有这个引用是为了支持方法调用中的动态连接。这些符号引用中一部分会在类加载阶段或者第一次使用的时候转换成直接引用(即在验证、准备、解析的解析阶段,比如说类中的 Read More
posted @ 2016-09-17 12:33 再见,少年 Views(238) Comments(0) Diggs(0) Edit
机器人的运动范围 题目描述 地上有一个m行和n列的方格。一个机器人从坐标0,0的格子开始移动,每一次只能向左,右,上,下四个方向移动一格,但是不能进入行坐标和列坐标的数位之和大于k的格子。 例如,当k为18时,机器人能够进入方格(35,37),因为3+5+3+7 = 18。但是,它不能进入方格(35 Read More
posted @ 2016-08-02 16:48 再见,少年 Views(162) Comments(0) Diggs(0) Edit
volatile是轻量级的synchronized,它在多处理器应用开发中保证了共享变量的“可见性”(可见性指当一个线程修改共享变量后,其它线程可以看到这个修改)。 volatile如果使用合理会比synchronized开销更小,因为volatile不会引起上下文的切换和调度。 在x86处理器上, Read More
posted @ 2016-06-16 09:59 再见,少年 Views(91) Comments(0) Diggs(0) Edit
定义局部最小的概念。arr长度为1时,arr[0]是局部最小。arr的长度为N(N>1)时,如果arr[0]<arr[1],那么arr[0]是局部最小;如果arr[N-1]<arr[N-2],那么arr[N-1]是局部最小;如果0<i<N-1,既有arr[i]<arr[i-1]又有arr[i]<ar Read More
posted @ 2016-06-01 21:44 再见,少年 Views(153) Comments(0) Diggs(0) Edit
有数组penny,penny中所有的值都为正数且不重复。每个值代表一种面值的货币,每种面值的货币可以使用任意张,再给定一个整数aim(小于等于1000)代表要找的钱数,求换钱有多少种方法。 给定数组penny及它的大小(小于等于50),同时给定一个整数aim,请返回有多少种方法可以凑成aim。 测试 Read More
posted @ 2016-06-01 09:50 再见,少年 Views(165) Comments(0) Diggs(0) Edit
对于两棵彼此独立的二叉树A和B,请编写一个高效算法,检查A中是否存在一棵子树与B树的拓扑结构完全相同。 给定两棵二叉树的头结点A和B,请返回一个bool值,代表A中是否存在一棵同构于B的子树。 核心代码: 对于两个字符串A和B,如果A和B中出现的字符种类相同且每种字符出现的次数相同,则A和B互为变形 Read More
posted @ 2016-05-15 17:15 再见,少年 Views(545) Comments(0) Diggs(0) Edit
上一页 1 2 3 4 5 6 ··· 17 下一页