摘要: 题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target valu... 阅读全文
posted @ 2015-07-10 16:01 Hygeia 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 题目: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... 阅读全文
posted @ 2015-07-10 14:43 Hygeia 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 题目:Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?... 阅读全文
posted @ 2015-07-09 10:51 Hygeia 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 题目Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following mat... 阅读全文
posted @ 2015-07-09 10:02 Hygeia 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[[ 1, 2, 3 ... 阅读全文
posted @ 2015-07-08 18:03 Hygeia 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 1 import java.util.ArrayList; 2 import java.util.Arrays; 3 4 5 public class Combination { 6 7 public static ArrayList> combine(int n, int ... 阅读全文
posted @ 2015-07-08 12:09 Hygeia 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目:Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,... 阅读全文
posted @ 2015-07-07 17:55 Hygeia 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not... 阅读全文
posted @ 2015-07-07 17:53 Hygeia 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. Yo... 阅读全文
posted @ 2015-07-05 13:58 Hygeia 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 1 import java.util.*; 2 import java.io.*; 3 import java.nio.file.*; 4 import java.lang.StringBuilder; 5 6 class FilePrep { 7 public static void ... 阅读全文
posted @ 2015-07-05 13:02 Hygeia 阅读(273) 评论(0) 推荐(0) 编辑