![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode算法
文章平均质量分 84
caoyan_12727
越努力越幸运
展开
-
Leetcode—最大无重复子串
题目如下:求一个字符串的最长无重复子串Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "原创 2016-07-17 11:45:21 · 1332 阅读 · 0 评论 -
Leetcode-403.Frog Jump(青蛙跳石头)
今天的题目是:Leetcode 403-青蛙跳A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into原创 2016-11-15 20:05:31 · 4270 阅读 · 0 评论 -
Leetcode-446. Arithmetic Slices II - Subsequence
题目:A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are arithmet原创 2016-12-06 20:52:36 · 1277 阅读 · 0 评论 -
Leetcode-467. Unique Substrings in Wraparound String
题目:Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".原创 2016-12-07 22:13:43 · 2007 阅读 · 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 you climb原创 2017-01-02 11:01:55 · 502 阅读 · 0 评论 -
464. Can I Win(something needed to be solved!)
写博客之前还是贴一下广州的天气:生活在广州的同学们傻傻分不清楚是冬天还是夏天。。。。。。下面我们进入正题:题目:In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the ru原创 2017-01-04 15:03:59 · 742 阅读 · 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 path.Note: You can only move either down or原创 2017-01-04 20:41:18 · 427 阅读 · 0 评论 -
Leetcode-62. Unique Paths and 63. Unique Paths II
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 tim原创 2017-01-04 22:02:58 · 414 阅读 · 0 评论 -
Leetcode-91. Decode Ways
Leetcode-91.Decode Ways题目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message contain原创 2017-01-05 12:00:13 · 521 阅读 · 0 评论 -
Leetcode-139. Word Break
题目:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. Y原创 2017-01-13 14:28:53 · 538 阅读 · 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 BST's. 1 3 3 2原创 2017-01-10 22:44:05 · 544 阅读 · 0 评论 -
Leetcode-95.Unique Binary Search Trees II(a representative recursion problem)
题目:Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown bel原创 2017-01-11 22:07:53 · 541 阅读 · 0 评论 -
Leetcode-32. Longest Valid Parentheses
题目:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses subs原创 2016-11-13 22:37:30 · 466 阅读 · 0 评论 -
Leetcode-264. Ugly Number II
题目:代码:版本1:class Solution1 {public: int nthUglyNumber(int n) { vectornum = {2,3,5}; vectorre; re.push_back(0); //少于6个数 for (int i = 0; i < 6; i++)re.push_back(1); if (n <= 6原创 2016-11-12 14:59:52 · 433 阅读 · 0 评论 -
leetcode-377. Combination Sum IV
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3]target = 4Th原创 2016-10-22 20:03:29 · 262 阅读 · 0 评论 -
leetcode-376. Wiggle Subsequence
题目:链接:https://leetcode.com/problems/wiggle-subsequence/A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negat原创 2016-10-22 21:57:53 · 311 阅读 · 0 评论 -
leetcode-363. Max Sum of Rectangle No Larger Than K
题目:Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its sum is no larger than k.Example:Given matrix = [ [1, 0, 1], [0, -2, 3原创 2016-10-23 15:13:31 · 567 阅读 · 0 评论 -
Leetcode-368. Largest Divisible Subset
题目:Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.If there are multiple solut原创 2016-10-24 12:56:35 · 293 阅读 · 0 评论 -
leetcode-357. Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x 题目的意思就是每一位上原创 2016-10-29 09:11:34 · 381 阅读 · 0 评论 -
Leetcode-354. Russian Doll Envelopes
题目:You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater th原创 2016-10-29 11:34:59 · 425 阅读 · 0 评论 -
Leetcode-321. Create Maximum Number
题目:原创 2016-11-06 20:31:52 · 595 阅读 · 0 评论 -
Leetcode-322.Coin Change
题目:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of m原创 2016-10-29 22:21:54 · 466 阅读 · 0 评论 -
Leetcode-312. Burst Balloons
题目:312. Burst Balloons Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If t原创 2016-11-09 22:36:27 · 491 阅读 · 0 评论 -
Leetcode-279. Perfect Squares
今天广州天气有点冷,如下图:so,刷个题暖暖身吧!!看题:279. Perfect Squares QuestionEditorial Solution My SubmissionsTotal Accepted: 56296Total Submissions: 163333Difficulty: MediumCon原创 2016-11-10 16:40:39 · 639 阅读 · 0 评论 -
Leetcode-198. House Robber,213. House Robber II
题目:原创 2016-11-15 22:15:59 · 466 阅读 · 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,2,1,-5,4],the contiguous subarray [4,-原创 2017-01-18 12:12:49 · 667 阅读 · 0 评论