- 博客(5)
- 收藏
- 关注
原创 3Sum——leetcode
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c
2015-02-05 16:56:02 573
原创 Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321此题看似简单,但有几种情况要注意:对于10这种数字的处理;对于溢出的处理。溢出不意味着ans_before解法一:采用x=reverse(reverse(x)) 的技巧判断是否溢出:public
2015-02-04 17:38:24 587
原创 Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f
2015-02-04 14:07:00 518
原创 Queue 的用法
对Queue 进队出队的使用不是很了解,刷题时想要直接用,所以查了一下。平时用的话用add 和remove 即可。Queue进队:boolean add(E e) //如果不会违反空间限制的话,插入指定对象e 到队列中,如果成功返回true,空间不够抛出异常。boolean offer(E e) //如果不会违反空间限制的话,插入指定对象e 到队列中。出队:E eleme
2015-02-04 12:28:46 603
原创 Compare Version Numbers
Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and co
2015-02-02 19:14:59 550
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人