Davey的专栏

不想再做一枚弱菜~Come On!

LeetCode -- 122. Best Time to Buy and Sell Stock II

题目:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may c...

2017-05-26 09:26:24

阅读数 133

评论数 0

LeetCode -- 121. Best Time to Buy and Sell Stock

题目:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transa...

2017-05-25 17:02:00

阅读数 180

评论数 0

LeetCode -- 120. Triangle

题目:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the...

2017-05-25 16:12:31

阅读数 141

评论数 0

LeetCode -- 96. Unique Binary Search Trees

题目:Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example, Given n = 3, there are a total of 5 unique B...

2017-05-17 23:20:26

阅读数 108

评论数 0

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 y...

2017-05-17 11:15:14

阅读数 107

评论数 0

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 pa...

2017-05-17 11:00:03

阅读数 111

评论数 0

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

2017-05-17 10:21:01

阅读数 106

评论数 0

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

2017-05-17 09:41:31

阅读数 187

评论数 0

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,...

2017-05-16 23:37:53

阅读数 112

评论数 0

LeetCode -- 5. Longest Palindromic Substring

题目:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"...

2017-05-16 22:49:14

阅读数 93

评论数 0

Leetcode -- 491. Increasing Subsequences

题目:Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasin...

2017-05-11 23:25:11

阅读数 231

评论数 0

Leetcode -- 38. Count and Say

题目:The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ...1 is read off as “one 1” or 11. 11 is r...

2017-05-10 23:54:02

阅读数 121

评论数 0

凸包(Convex Hull)问题的三种解法: 暴力,Graham Scan,分治

凸包问题描述:平面上n个点的集合Q的convex hull是一个最小凸多边形P,Q的点或者在P上或者在P内。凸多边形P是具有如下性质多边形:连接P内任意两点的边都在P内 暴力法: 思想:从所有的点中找到y坐标最小的点P0,此点一定在凸包内,加入到凸包点集,然后遍历剩下点: 每次选取两个点Pi,P...

2017-05-08 10:21:26

阅读数 733

评论数 0

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