- 博客(34)
- 收藏
- 关注
原创 Leetcode算法习题 第十九周
376. Wiggle Subsequence A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one
2018-01-12 15:44:33
224
原创 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
2018-01-12 15:14:37
223
原创 Leetcode 算法习题 第十七周
392. Is Subsequence Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (le
2018-01-12 15:12:57
230
原创 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 posit
2018-01-12 15:11:17
307
原创 Leetcode 算法习题 第十五周
309. Best Time to Buy and Sell Stock with Cooldown 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-12-13 15:34:14
224
原创 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 = [
2017-12-08 17:16:43
166
原创 Leetcode 算法习题 第十四周
392. Is Subsequence Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (le
2017-12-08 16:26:15
151
原创 Leetcode 算法习题 第十四周
413. Arithmetic Slices A sequence of number 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, thes
2017-12-07 15:28:03
177
原创 Leetcode 算法习题 第十四周
523. Continuous Subarray Sum Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multi
2017-12-07 10:40:55
179
原创 Leetcode 算法习题 第十四周
516. Longest Palindromic Subsequence Given a string s, find the longest palindromic subsequence’s length in s. You may assume that the maximum length of s is 1000. Example 1: Input: “bbbab
2017-12-06 09:59:31
194
原创 Leetcode 算法习题 第十四周
646. Maximum Length of Pair Chain You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow another pair
2017-12-06 09:16:49
251
原创 Leetcode 算法习题 第十四周
714. Best Time to Buy and Sell Stock with Transaction Fee Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee
2017-12-05 10:56:14
183
原创 Leetcode 算法设计 第十四周
688. Knight Probability in Chessboard On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so the top-left s
2017-12-05 10:34:54
188
原创 Leetcode 算法设计 第十四周
698. Partition to K Equal Sum Subsets Given an array of integers nums and a positive integer k, find whether it’s possible to divide this array into k non-empty subsets whose sums are all equal. E
2017-12-05 10:14:49
214
原创 Leetcode 算法设计 第十四周
718. Maximum Length of Repeated Subarray Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3,2,1
2017-12-04 13:23:46
207
原创 Leetcode 算法设计 第十三周
221. Maximal Square Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. For example, given the following matrix: 1 0 1 0 0 1
2017-12-02 15:13:20
189
原创 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
2017-12-01 16:38:43
151
原创 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 tha
2017-11-30 15:43:13
367
原创 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 r
2017-11-29 15:34:59
219
原创 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 tr
2017-11-28 20:52:21
165
原创 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 contiguo
2017-11-28 20:13:06
232
原创 Leedcode 算法习题 第十一周
134. Gas Station There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel f
2017-11-28 16:37:49
226
原创 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
2017-11-09 17:25:05
171
原创 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 following triangle [ [2
2017-10-31 20:58:33
202
原创 Leetcode 算法习题 第八周
213. House Robber II After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this plac
2017-10-29 09:21:41
210
原创 Leedcode 算法习题 第七周
198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is
2017-10-28 23:46:03
309
原创 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 transaction (ie, buy
2017-10-15 16:10:08
240
原创 Leetcode 算法习题 第六周
100. Same Tree Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same val
2017-10-11 22:01:41
216
原创 Leetcode 算法习题 第五周
35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume
2017-10-04 14:20:03
184
原创 LeetCode 算法习题 第四周
21. Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.题目大意:将两个有序的list 进行归并排序,默认从小到大的
2017-09-26 19:17:48
191
原创 LeetCode 算法习题 第四周
19. Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After r
2017-09-25 21:54:44
311
原创 LeetCode 算法习题 第三周
Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 题目大意将一个整数进行位数调换,使得最高位成为个位,次高位成为十位,…… 比如123 变成321我的解答class Solution {public: in
2017-09-22 21:44:38
264
原创 LeetCode 算法习题 第二周
Add Two Numbers You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the t
2017-09-18 20:37:25
352
原创 LeetCode 算法习题 第一周
算法设计课后作业第一周Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use
2017-09-10 11:50:30
236
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人