leetcode
文章平均质量分 79
taiyangdixiasj
这个作者很懒,什么都没留下…
展开
-
Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".开始这么写的:原创 2014-11-17 23:01:17 · 518 阅读 · 0 评论 -
Find Minimum in Rotated Sorted Array
package leetcode;/* * * 注意问题: * 1. 原序列升序、降序问题,两种情况都要考虑 * 2. 边界问题,如果只有两个元素时要单独考虑,在num[mid]==num[left]判断中考虑 * 3. 采用2叉查找的思想 * */public class findMinInRotatedSortedArray { public int findMin(int[]原创 2014-11-16 22:49:48 · 471 阅读 · 0 评论 -
Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?public class Solution {//inplace solution publi原创 2015-01-30 09:39:18 · 456 阅读 · 0 评论 -
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 · 535 阅读 · 0 评论 -
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 · 567 阅读 · 0 评论 -
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 · 502 阅读 · 0 评论 -
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 · 555 阅读 · 0 评论