自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

andersonxie的博客

https://github.com/Sheldon-Anderson

  • 博客(84)
  • 资源 (2)
  • 收藏
  • 关注

原创 LeetCode 84. Largest Rectangle in Histogram(直方图中最大矩形面积)

题目描述:    Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.        Above is a histogram where ...

2018-03-27 22:04:32 2648 1

原创 LeetCode 83. Remove Duplicates from Sorted List(移除单链表的重复元素Ⅰ)

题目描述:    Given a sorted linked list, delete all duplicates such that each element appear only once.    For example,        Given 1->1->2, return 1->2.        Given 1->1->2->3->3, ...

2018-03-27 21:25:40 229

原创 LeetCode 82. Remove Duplicates from Sorted List II(移除单链表的重复元素Ⅱ)

题目描述:    Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.    For example,        Given 1->2->3->3->4->4-&g...

2018-03-27 21:08:32 390

原创 LeetCode 81. Search in Rotated Sorted Array II(旋转有序数组,朝找目标值Ⅱ)

题目描述:    Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.    (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).    Write a function to determine if a given...

2018-03-27 20:32:31 179

原创 LeetCode 80. Remove Duplicates from Sorted Array II(有序数组移除重复数字Ⅱ)

题目描述:    Follow up for "Remove Duplicates": what if duplicates are allowed at most twice?    For example, given sorted array nums = [1,1,1,2,2,3].    Your function should return length = 5, with the f...

2018-03-26 20:16:11 216

原创 LeetCode 79. Word Search(单词查找)

题目描述:    Given a 2D board and a word, find if the word exists in the grid.    The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or v...

2018-03-26 19:40:12 351

原创 LeetCode 78. Subsets(子集)

题目描述:    Given a set of distinct integers, nums, return all possible subsets (the power set).    Note: The solution set must not contain duplicate subsets.    For example, if nums = [1,2,3], a solutio...

2018-03-26 19:16:00 209

原创 LeetCode 77. Combinations(N选K组合)

题目描述:    Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.    For example, If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1...

2018-03-26 17:41:39 551

原创 LeetCode 76. Minimum Window Substring(最小窗口子串)

题目描述:    Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).    For example, S = "ADOBECODEBANC", T = "ABC", Minimum window is ...

2018-03-26 17:31:01 237

原创 LeetCode 75. Sort Colors(三颜色排序→K颜色排序)

题目描述:    Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.    Here, we will use the ...

2018-03-26 16:29:28 3959

原创 LeetCode 74. Search a 2D Matrix(二维矩阵查找)

题目描述:    Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right.The first integer of ea...

2018-03-26 15:55:29 261

原创 LeetCode 73. Set Matrix Zeroes(矩阵置零)

题目描述:    Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.分析:    题意:给定一个 m x n 二维整型数组,如果某个元素为零,则把包含该元素的行、列所有元素都置零。返回置零之后的矩阵,空间复杂度要求为O(1)。    思路:这是一道模拟题,因为空间...

2018-03-26 15:35:43 252

原创 LeetCode 72. Edit Distance(编辑距离)

题目描述:    Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)    You have the following 3 operations permitted o...

2018-03-26 15:05:36 135

原创 LeetCode 71. Simplify Path(路径简化)

题目描述:    Given an absolute path for a file (Unix-style), simplify it.    For example,        path = "/home/", => "/home"         path = "/a/./b/../../c/", => "/c"    Corner Cases:Did you conside...

2018-03-25 21:01:32 189

原创 LeetCode 70. Climbing Stairs(爬梯子)

题目描述:    You are climbing a stair case. It takes n steps to reach to the top.    Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?    Note: Given n will ...

2018-03-25 18:33:05 427

原创 LeetCode 69. Sqrt(x)(x的算术平方根)

题目描述:    Implement int sqrt(int x).    Compute and return the square root of x.    x is guaranteed to be a non-negative integer.例子:Input: 4Output: 2Input: 8Output: 2Explanation: The square root of ...

2018-03-25 17:28:10 385

原创 LeetCode 68. Text Justification(文本格式调整)

题目描述:    Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.    You should pack your words in a greedy approac...

2018-03-24 19:44:14 213

原创 LeetCode 67. Add Binary(二进制加法)

题目描述:    Given two binary strings, return their sum (also a binary string).    For example, a = "11", b = "1", return "100".分析:    题意:给定两个二进制字符串(只包含0和1),返回它们相加之后的字符串结果。    思路:这是一道二进制加法题,我们采用普通的字符串加法思路...

2018-03-24 18:57:59 246

原创 LeetCode 66. Plus One(加一)

题目描述:    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.   ...

2018-03-24 18:10:35 121

原创 LeetCode 65. Valid Number(合法数字→最差的题!)

题目描述:    Validate if a given string is numeric.例子:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true注意:It is intended for the problem statement to be amb

2018-03-24 18:00:20 234

原创 LeetCode 64. 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 either down or...

2018-03-24 16:55:18 137

原创 LeetCode 63. 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 respectively ...

2018-03-24 16:45:31 125

原创 LeetCode 62. 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 trying to r...

2018-03-24 16:29:44 138

原创 LeetCode 61. Rotate List(循环右移单链表)

题目描述:    Given a list, rotate the list to the right by k places, where k is non-negative.例子:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.分析:    题意:给定一...

2018-03-24 15:57:35 754

原创 LeetCode 60. Permutation Sequence(N排列,第K序列)

题目描述:    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):"123""132""213""2...

2018-03-24 15:33:07 306

原创 LeetCode 59. 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, 2, 3 ], [ 8, 9, 4 ...

2018-03-24 14:48:56 127

原创 LeetCode 58. 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 0.    Note: A ...

2018-03-23 22:43:19 150

原创 LeetCode 57. 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 ti...

2018-03-22 16:10:30 150

原创 LeetCode 56. 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].分析:    题意:给出一些整型区间集合,返回合并重叠区间之后的结果。    思路:这是一道...

2018-03-22 16:01:16 1821

原创 LeetCode 55. 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.    De...

2018-03-22 15:36:55 129

原创 LeetCode 54. 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 ], [ 7, 8, 9 ]...

2018-03-22 15:28:04 138

原创 LeetCode 53. 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...

2018-03-22 15:24:11 150

原创 LeetCode 52. N-Queens II(N皇后问题Ⅱ)

题目描述:    Follow up for N-Queens problem.    Now, instead outputting board configurations, return the total number of distinct solutions.    分析:    题意:在n×n的国际象棋棋盘上,摆放n个皇后,使得任意两个皇后不在同一行、同一列、同一条45°斜线上。返回...

2018-03-22 15:17:35 146

原创 LeetCode 51. N-Queens(N皇后问题Ⅰ)

题目描述:    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-queens...

2018-03-22 15:14:26 158

原创 LeetCode 50. Pow(x, n)(幂)

题目描述:    Implement pow(x, n).例子:Input: 2.00000, 10Output: 1024.00000Input: 2.10000, 3Output: 9.26100分析:    题意:计算x的n次方,其中x为double型,n为int型。    思路:这是一道经典的快速幂计算问题,借助于二分法的思想,已经有成熟的算法。假设ans初始化为1.0,进入循环:① ...

2018-03-22 14:57:55 121

原创 LeetCode 49. Group Anagrams(聚类错位词)

题目描述:    Given an array of strings, group anagrams together.    For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"],     Return:[ ["ate", "eat","tea"],

2018-03-22 14:41:33 201

原创 LeetCode 48. Rotate Image(旋转图片)

题目描述:    You are given an n x n 2D matrix representing an image.    Rotate the image by 90 degrees (clockwise).    Note:        You have to rotate the image in-place, which means you have to modify th...

2018-03-22 14:34:21 148

原创 LeetCode 47. 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], [1,2,1], ...

2018-03-21 18:36:28 108

原创 LeetCode 46. Permutations(排列Ⅰ)

题目描述:    Given a collection of distinct 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], [3...

2018-03-20 15:44:38 76

原创 LeetCode 45. 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.    Yo...

2018-03-20 15:29:48 157

《Pattern Recognition and Machine Learning》(中文版)超清扫描PDF版本

书名:Pattern Recognition and Machine Learning 作者:Christopher M. Bishop 译名:模式识别与机器学习 译者:马春鹏 目录 1 绪论 2 概率分布 3 回归的线性模型 4 分类的线性模型 5 神经网络 6 核方法 7 稀疏核机 8 图模型 9 混合模型和EM 10 近似推断 11 采样方法 12 连续潜在变量 13 顺序数据 14 组合模型 A 附录A.数据集 B 附录B.概率分布 C 附录C.矩阵的性质 D 附录D.变分法 E 附录E.拉格朗日乘数法 推荐原因:一个研究人工智能领域的学者,只有读过这本书,才能说机器学习的理论已经入门了。

2018-03-12

LeetCode400题代码全解

这里提供我刷LeetCode前400题的代码全解,部分题目还提供了2-4种解法,对于刷题的你,想必会很有帮助!

2017-08-10

空空如也

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

TA关注的人

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