摘要: 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 maxim 阅读全文
posted @ 2014-11-17 08:12 LiBlog 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 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 maximu... 阅读全文
posted @ 2014-11-17 07:04 LiBlog 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3,You should return the followin... 阅读全文
posted @ 2014-11-17 06:40 LiBlog 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix:[ [ 1,... 阅读全文
posted @ 2014-11-17 06:34 LiBlog 阅读(126) 评论(0) 推荐(0) 编辑
摘要: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequenc 阅读全文
posted @ 2014-11-17 05:54 LiBlog 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->... 阅读全文
posted @ 2014-11-17 04:42 LiBlog 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i... 阅读全文
posted @ 2014-11-17 04:17 LiBlog 阅读(111) 评论(0) 推荐(0) 编辑
摘要: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any po... 阅读全文
posted @ 2014-11-17 04:05 LiBlog 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.N... 阅读全文
posted @ 2014-11-17 00:30 LiBlog 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x).Compute and return the square root of x.Analysis:Using binary search to find the solution. However, what need to be consider... 阅读全文
posted @ 2014-11-17 00:18 LiBlog 阅读(168) 评论(0) 推荐(0) 编辑