自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

大气人生

点滴星沙,能塑之,能扬之,方成沙海

  • 博客(27)
  • 收藏
  • 关注

原创 最短路径

最短路径问题对于如下的图来说,每一个“∙\bullet”代表一个节点,节点与节点之间是他们之间相应的边权,由于这个图类似于矩阵的形式,所以当给定坐标(x1,y1)和(x2,y2)(x_1, y_1)和(x_2, y_2)时,求这两个节点之间的最短路径。在下面这个图中,最原始的图应该是每条边代表转移概率,这里将概率乘以10取整后得到,也就是每个节点相连边的权值和为10.∙−5−∙−4−∙−4−∙−

2015-08-15 11:03:47 1123

原创 Leetcode65 Plus One

Plus One Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list.Solution1pu

2015-08-12 23:36:18 540

原创 Leetcode64 Minimum Path Sum

Minimum Path Sum 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 eit

2015-08-12 23:09:36 543

原创 Leetcode63 Unique Paths II

Unique Paths II 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 is marked as 1 and 0 r

2015-08-12 22:38:57 371

原创 Leetcode62 Unique Paths

Unique Paths 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 time. The robot is tryi

2015-08-12 19:35:09 465

原创 Leetcode61 Rotate List

Rotate List 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->NULL.Solution利用两个指针定位

2015-08-10 13:37:47 356

原创 Leetcode60 Permutation Sequence

Permutation Sequence 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 sequence (ie, for n = 3):"1

2015-08-10 13:09:05 453

原创 Leetcode59 Spiral Matrix II

Spiral Matrix II 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 following matrix:[ [ 1,

2015-08-10 11:12:08 424

原创 Leetcode58 Length of Last Word

Length of Last Word Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string. If the last word does not exist, return

2015-08-10 10:29:14 434

原创 Leetcode57 Insert Interval

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 thei

2015-08-10 01:39:20 460

原创 Leetcode56 Merge Intervals

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].Solution将所有的interval按照起点进行排序,

2015-08-09 23:12:31 632

原创 Leetcode55 Jump Game

Jump Game 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.

2015-08-09 22:28:49 425

原创 Leetcode54 Spiral Matrix

Spiral Matrix  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, 2, 3 ], [ 4, 5, 6 ],

2015-08-09 21:57:49 389

原创 Leetcode53 Maximum Subarray

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

2015-08-09 17:18:49 435

原创 Leetcode52 N-Queens II

N-Queens II Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions.Solution在上一题的基础上,这道题显得过于简单。public class Solution {

2015-08-09 16:51:14 340

原创 Leetcode51 N-Queens

N-Queens The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-que

2015-08-09 16:35:39 400

原创 Leetcode50 Pow(x, n)

Pow(x, n) Implement pow(x, n).Solution1最简单的方法当然就是按照幂运算的规则一个一个去乘方了。如下:public class Solution { public double myPow(double x, int n) { if(x>-0.000001&&x<0.000001) return 0; if(n==

2015-08-09 15:41:34 640

原创 Leetcode49 Anagrams

Anagrams Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case.Solution1这道题是用来找到字符串数组中的所有由相同字符(个数也相同)构成的字符串,例如[“ate”,”and”,”dna”,”dd

2015-08-09 13:56:53 373

原创 Leetcode48 Rotate Image

Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise).Solution1这道题无非是一些边界条件的把握。public class Solution { public void rotate(int[][]

2015-08-08 18:35:19 366

原创 Leetcode47 Permutations II

Permutations II Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2],

2015-08-08 01:41:51 366

原创 Leetcode46 Permutations

Permutations Given a collection of numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]

2015-08-07 23:58:19 447

原创 Leetcode45 Jump Game II

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

2015-08-07 23:20:24 344

原创 Leetcode44 Wildcard Matching

Wildcard Matching Implement wildcard pattern matching with support for ‘?’ and ‘*’. ‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).

2015-08-07 12:10:25 434

原创 Leetcode43 Multiply Strings

Multiply Strings Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative.Solution1最简单的方法就是完全

2015-08-06 15:12:26 710

原创 Leetcode42 Trapping Rain Water

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

2015-08-06 10:18:12 354

原创 Leetcode41 First Missing Positive

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 ru

2015-08-05 17:59:26 482

原创 Leetcode40 Combination Sum II

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

2015-08-05 16:22:47 428

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除