- 博客(19)
- 资源 (4)
- 收藏
- 关注
原创 Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinct numbers from the original list. For example,Given 1->2->3->3->4->4->5, return1->2->5.Given 1->1
2014-09-25 20:46:24 397
原创 Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear onlyonce. For example,Given 1->1->2, return1->2.Given 1->1->2->3->3, return1->2->3.代码:链表类的问题
2014-09-25 20:44:50 406
原创 Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Examp
2014-09-25 20:41:26 396
原创 Merge Intervals
Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].解法一:
2014-09-25 20:40:10 379
原创 Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1] ha
2014-09-25 20:37:14 370
原创 ubuntu 12.04 安装 JDK
1、到 Sun 的官网下载http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 选择 accept license ,然后选择适合自己机型的JDK下载。2、解压文件,修改文件名$ sudo mkdir /usr/lib/jvm$ sudo tar zx
2014-09-25 14:29:09 552
原创 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?由于要原地进行rotate,故而只能
2014-09-21 14:47:43 534
原创 编译hadoop源码
一、首先下载hadoop源码包下载的方式还是比较多的1.svn的方式svn下载首先需要安装SVN,如果想尝试使用svn,可以参考源码管理、获取网络源码工具:TortoiseSVN使用手册,hadoop的svn下载地址点此2.压缩包的方式这里我们介绍一种压缩包的方式。首先我们登录官网:http://hadoop.apache.org/,我们找到下面链接,点进去下载即可。如
2014-09-21 14:45:40 1651
原创 ubuntu 12.04下安装并运行hadoop
介绍Hadoop的安装之前,先介绍一下Hadoop对各个节点的角色定义。Hadoop分别从三个角度将主机划分为两种角色。第一,最基本的划分为Master和Slave,即主人与奴隶;第二,从HDFS的角度,将主机划分为NameNode和DataNode(在分布式文件系统中,目录的管理很重要,管理目录相当于主人,而NameNode就是目录管理者);第三,从MapReduce的角度,将主机划分为
2014-09-20 20:35:15 1534
原创 Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]
2014-09-20 09:42:53 469
原创 First Missing Positive
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 should run in O(n) time and uses constant
2014-09-20 09:40:24 367
原创 Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited numb
2014-09-20 09:31:18 498
原创 Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combina
2014-09-20 09:31:07 381
原创 Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.
2014-09-20 09:26:34 405
原创 Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal i
2014-09-20 09:23:48 380
原创 How to import Gradle project into eclipse .
How to Integrate Eclipse with Gradle project?1.download groovy eclipse plugin ---3.7 (Indigo) http://dist.springsource.org/release/GRECLIPSE/e3.7/2.download gradle eclipse plugin ---http://dist.
2014-09-17 16:00:28 1348
原创 Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its
2014-09-14 20:57:40 395
原创 Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found in
2014-09-14 20:54:30 399
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人