![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法应用作业
文章平均质量分 70
勺月
这个作者很懒,什么都没留下…
展开
-
LeetCode作业: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 s原创 2017-03-04 17:27:16 · 183 阅读 · 0 评论 -
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, these ar原创 2017-05-13 20:56:01 · 116 阅读 · 0 评论 -
LeetCode题目:452. Minimum Number of Arrows to Burst Balloons Add to List
题目原址:点击打开链接 题目描述:There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since i原创 2017-04-23 15:14:15 · 178 阅读 · 0 评论 -
LeetCode题目392. Is Subsequence
题目原址:点击打开链接 题目描述:Given a string s and a string t, check ifs is subsequence of t. You may assume that there is only lower case English letters in both s andt. t is potentially a very long (le原创 2017-04-23 15:57:19 · 144 阅读 · 0 评论 -
LeetCode题目:338. Counting Bits
题目原址:点击打开链接 题目描述:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.原创 2017-05-06 18:43:33 · 170 阅读 · 0 评论 -
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 containing digits,原创 2017-05-06 18:59:22 · 289 阅读 · 0 评论 -
LeetCode题目:486. Predict the Winner
题目原址:点击打开链接 题目描述:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each原创 2017-05-28 12:00:28 · 213 阅读 · 0 评论 -
LeetCode题目:357. Count Numbers with Unique Digits
题目原址:点击打开链接 题目描述:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of原创 2017-05-20 19:52:15 · 138 阅读 · 0 评论 -
LeetCode题目:343. Integer Break
题目地址:点击打开链接 题目描述:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For exa原创 2017-05-20 20:22:10 · 141 阅读 · 0 评论 -
LeetCod题目:Container With Most Water
题目地址:点击打开链接题目描述:Given n non-negative integers a1,a2, ..., an, where each represents a point at coordinate (i,ai). n vertical lines are drawn such that the two endpoints of linei is at (i,原创 2017-06-17 19:15:26 · 147 阅读 · 0 评论 -
LeetCode题目:Integer to Roman
题目原址:点击打开链接题目描述:Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.Subscribe to see which companies asked this question.代码:cla原创 2017-06-17 19:26:31 · 151 阅读 · 0 评论 -
LeetCode题目:Roman to Integer
题目地址:点击打开链接题目描述:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999代码:class Solution {public: int romanToInt(string s) { unorde原创 2017-06-17 19:43:28 · 144 阅读 · 0 评论 -
LeetCode题目:494. Target Sum
题目地址:点击打开链接 题目描述: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 should choose one from + and - as its new s原创 2017-06-03 16:19:02 · 209 阅读 · 0 评论 -
LeetCode题目7. Reverse Integer
题目原址:点击打开链接题目描述:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers.Have you thought about this?Here are some good question原创 2017-06-03 18:06:35 · 126 阅读 · 0 评论 -
算法概论课本题目Chapter 8 Exercises 8.10
8.10. Proving NP-completeness by generalization. For each of the problems below, prove that it is NP-complete by showing that it is a generalization of some NP-complete problem we have seen in this ch原创 2017-06-19 16:08:41 · 338 阅读 · 0 评论 -
LeetCode题目:String to Integer (atoi)
题目原址:点击打开链接题目描述:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are t原创 2017-06-10 19:36:00 · 142 阅读 · 0 评论 -
LeetCode 题目 :455. Assign Cookies
题目原址:点击打开链接 题目描述:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the原创 2017-04-16 20:54:47 · 139 阅读 · 0 评论 -
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 dayi.Design an algorithm to find the maximum profit. You may complete as many transactions原创 2017-04-16 20:34:35 · 146 阅读 · 0 评论 -
LeetCode作业Majority Element
题目原址:点击打开链接题目描述:Given an array of size n, find the majority element. The majority element is the element that appearsmore than⌊ n/2 ⌋ times.You may assume that the array is non-empty a原创 2017-03-04 17:45:10 · 187 阅读 · 0 评论 -
算法设计与应用基础作业(一)
题目网址:点击打开链接题目描述:Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three dig原创 2017-02-25 17:20:19 · 239 阅读 · 0 评论 -
算法设计与应用基础作业(二)
题目地址:点击打开链接题目描述: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原创 2017-02-25 17:45:11 · 182 阅读 · 0 评论 -
算法设计与应用基础作业(三)
题目地址:点击打开链接题目描述:In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attackingascending time series towards Ashe原创 2017-02-26 00:02:43 · 211 阅读 · 0 评论 -
LeeCode题目:169. Majority Element Add to List
题目地址:点击打开链接 题目描述:Given an array of size n, find the majority element. The majority element is the element that appearsmore than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the原创 2017-03-18 19:01:32 · 288 阅读 · 0 评论 -
LeetCode 题目:312. Burst Balloons
题目地址:点击打开链接 题目描述:Given n balloons, indexed from0 ton-1. Each balloon is painted with a number on it represented by arraynums. You are asked to burst all the balloons. If the you burst balloo原创 2017-03-18 20:59:27 · 205 阅读 · 0 评论 -
LeetCode题目Kth Largest Element in an Array
题目原址:点击打开链接题目描述:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] a原创 2017-03-11 21:45:27 · 238 阅读 · 0 评论 -
LetetCode题目Search a 2D Matrix II
题目地址:点击打开链接 题目描述:Write an efficient algorithm that searches for a value in anm xn matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left原创 2017-03-12 11:59:40 · 262 阅读 · 0 评论 -
LeetCode题目:6. ZigZag Conversion Add to List
题目原址:点击打开链接 题目描述:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H原创 2017-04-08 14:20:26 · 242 阅读 · 0 评论 -
LeetCode 题目 4. Median of Two Sorted Arrays
题目原址 :点击打开链接 题目描述:There are two sorted arrays nums1 andnums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).原创 2017-04-02 11:56:21 · 279 阅读 · 0 评论 -
LeetCode题目 5. Longest Palindromic Substring
题目地址:点击打开链接 题目描述:Given a string s, find the longest palindromic substring ins. You may assume that the maximum length ofs is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is al原创 2017-04-02 16:05:32 · 178 阅读 · 0 评论 -
LeetCode 作业题目:2. 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原创 2017-03-26 14:36:14 · 227 阅读 · 0 评论 -
LeetCode 题目 3. Longest Substring Without Repeating Characters Add to List
题目地址 点击打开链接 题目描述: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 "bbbb原创 2017-03-26 15:53:11 · 279 阅读 · 1 评论 -
LeetCode 题目:435. Non-overlapping Intervals Add to List
题目原址:点击打开链接 题目描述:Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note:You may assume the interv原创 2017-04-29 14:22:36 · 194 阅读 · 0 评论 -
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 exis原创 2017-04-29 15:19:38 · 131 阅读 · 0 评论 -
LeetCode题目:Palindrome Number
题目地址:点击打开链接题目描述:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thi原创 2017-06-10 20:11:17 · 142 阅读 · 0 评论