- 博客(17)
- 收藏
- 关注
原创 算法题目--Assign Cookies
题目来源 https://leetcode.com/problems/assign-cookies/description/题目描述Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one c
2018-01-21 23:55:43
276
原创 算法题目---Best Time to Buy and Sell Stock
题目来源 https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/题目描述Say you have an array for which the i*th element is the price of a given stock on day *i.If you were onl
2018-01-21 23:19:52
214
原创 算法题目--Jump Game
题目来源 https://leetcode.com/problems/jump-game/description/题目描述Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the arra
2018-01-21 22:58:18
257
原创 算法题目--证明题
题目来源 算法概论课后题8.14题目描述证明如下问题是NP完全的:给定一个无向图G =(V,E)和整数k,求G中一个规模为k的团以及一个规模为k的独立集。假定它们都是存在的。证明在G中添加k个相互独立的顶点,得到的一个新的图G’。这样G‘中存在大小为K的独立集,而且G的团没有发生改变。于是原问题转化成了先求出G规模为k的团,再添加k个顶点的独立集。已知求解G中
2018-01-21 22:18:28
754
原创 算法题目--分组
题目描述对于一个整数数列A[0], A[1], …, A[N-1]进行分组,要求每组1到2个数,并且同组之和不能大于w. 求最少可以分成多少组.1 请实现下面Solution类中计算minPartition(A, w)的函数.class Solution {public: int minPartition(vector A, int w) {
2018-01-07 22:04:44
1434
原创 算法题目--Maximum Product Subarray
题目来源 https://leetcode.com/problems/maximum-product-subarray/description/题目描述Find the contiguous subarray within an array (containing at least one number) which has the largest product.For
2018-01-06 16:36:02
229
原创 算法题目--Binary Tree Paths
题目来源 https://leetcode.com/problems/binary-tree-paths/description/题目描述Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2
2018-01-06 16:34:25
186
原创 算法题目--Search a 2D Matrix II
题目来源 https://leetcode.com/problems/search-a-2d-matrix-ii/description/题目描述Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers
2018-01-03 23:47:14
205
原创 算法题目--Target Sum
题目来源 https://leetcode.com/problems/target-sum/description/题目描述You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each integer, you sho
2018-01-03 21:07:26
564
原创 算法题目--Min Cost Climbing Stairs
题目来源 https://leetcode.com/problems/min-cost-climbing-stairs/description/题目描述On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).Once you pay the cost, you can eithe
2018-01-03 21:06:52
223
原创 算法题目--Maximum Length of Repeated Subarray
题目来源 https://leetcode.com/problems/maximum-length-of-repeated-subarray/description/题目描述Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example
2018-01-03 21:06:08
184
原创 算法题目--Monotone Increasing Digits
题目来源 https://leetcode.com/problems/monotone-increasing-digits/description/题目描述Given a non-negative integer N, find the largest number that is less than or equal to N with monotone increasing digits.
2017-12-27 22:22:24
187
原创 算法题目--Longest Palindromic Substring
题目来源 https://leetcode.com/problems/longest-palindromic-substring/description/题目描述Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Ex
2017-12-27 20:38:47
162
原创 算法题目--Longest Substring Without Repeating Characters
题目来源 https://leetcode.com/problems/longest-substring-without-repeating-characters/description/题目描述Given a string, find the length of the longest substring without repeating characters.Examples:Given
2017-12-19 22:41:48
147
原创 算法题目--Delete and Earn
Given an array nums of integers, you can perform operations on the array.In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every element
2017-12-05 16:01:11
260
原创 算法题目--Add Two Numbers
题目来源:https://leetcode.com/problems/add-two-numbers/description/题目描述:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order
2017-09-19 19:05:21
447
原创 算法题目--Two Sum
#include#includeusing namespace std;class Solution {public: vector twoSum(vector& nums, int target) { for (int i = 0; i < nums.size(); i++) { //二重循环 for (int j = i + 1; j < nums.size()
2017-09-08 17:55:01
315
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人