摘要: /** * Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero, except the number 0 itself. Th... 阅读全文
posted @ 2017-07-28 17:49 stAr_1 阅读(165) 评论(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. Note: You can only move either down o... 阅读全文
posted @ 2017-07-28 16:52 stAr_1 阅读(122) 评论(0) 推荐(0) 编辑
摘要: /** * Created by lvhao on 2017/7/6. * 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 point in... 阅读全文
posted @ 2017-07-06 17:57 stAr_1 阅读(231) 评论(0) 推荐(0) 编辑
摘要: import java.util.Arrays; /** * Created by lvhao on 2017/7/6. * Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You sh... 阅读全文
posted @ 2017-07-06 15:46 stAr_1 阅读(199) 评论(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 maximum jump length at that position. Deter... 阅读全文
posted @ 2017-07-05 16:39 stAr_1 阅读(2126) 评论(0) 推荐(1) 编辑
摘要: import java.util.ArrayList; import java.util.List; /** * 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 follow... 阅读全文
posted @ 2017-07-05 11:30 stAr_1 阅读(364) 评论(0) 推荐(0) 编辑
摘要: /** * 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,... 阅读全文
posted @ 2017-07-04 18:01 stAr_1 阅读(219) 评论(0) 推荐(0) 编辑
摘要: import java.util.Arrays; /** * 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? 翻转二维数组,思路是把数组分成length... 阅读全文
posted @ 2017-07-04 17:21 stAr_1 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 和39题不同的地方:1.数组中有重复的数 2.数组中的数只能用一次 阅读全文
posted @ 2017-07-03 17:59 stAr_1 阅读(123) 评论(0) 推荐(0) 编辑
摘要: public static int searchInsert(int[] nums, int target) { int sta = 0,fin = nums.length,mid; while (sta < fin) { mid = (sta + fin )/2; if(nums[mid] < ta... 阅读全文
posted @ 2017-07-03 17:09 stAr_1 阅读(292) 评论(0) 推荐(0) 编辑