自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(24)
  • 收藏
  • 关注

原创 算法概论习题 8.22 NP-完全问题证明

题目:8.22 问题描述: 在任务调度,它常常可以用图进行每个任务的节点和有向边的任务我的任务,如果我是一个先决条件J.这个有向图描绘的优先约束的调度问题。显然,当且仅当图是循环的时,调度是可能的;如果它不是,我们想确定必须丢弃的最小数量的约束,以便使其循环。给定一个有向图G =(V,E),子集E0⊆E称为反馈弧集如果边E0呈现G环的去除。反馈弧集(FAS):给定一个有向图G

2017-01-07 21:03:47 1050

原创 【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 position.Your goal is

2016-10-18 23:32:02 241

原创 【leetcode】55. Jump Game

Difficulty:MediumGiven 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 th

2016-10-18 23:13:24 223

原创 【leetcode】188. Best Time to Buy and Sell Stock IV

Difficulty:HardSay 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 at most k transactions.

2016-10-18 22:42:04 229

原创 【leetcode】123. Best Time to Buy and Sell Stock III

Difficulty:HardSay 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 complete at most two transac

2016-10-09 00:52:11 251

原创 【leetcode】122. Best Time to Buy and Sell Stock II

Difficulty:MediumSay 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 complete as many transactions

2016-10-09 00:46:30 191

原创 【leetcode】121. Best Time to Buy and Sell Stock

Difficulty:Easyay 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 one and sell one

2016-10-09 00:40:31 190

原创 【leetcode】75. Sort ColorsD

Difficulty:MediumGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we

2016-09-30 00:49:40 243

原创 【leetcode】215. Kth Largest Element in an Array

Difficulty:MediumFind 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

2016-09-30 00:36:19 311

原创 【leetcode】4. Median of Two Sorted Arrays

Difficulty:HardThere are two sorted arrays nums1 and nums2 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)).E

2016-09-29 23:43:53 261

原创 【leetcode】34. Search for a Range

Difficulty:mediumGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If t

2016-09-21 10:28:46 291

原创 【leetcode】74. Search a 2D Matrix

Difficulty:mediumWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.Th

2016-09-21 09:49:25 232

原创 【leetcode】35. Search Insert Position

Difficulty:mediumGiven 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 no d

2016-09-21 09:35:18 198

原创 【leetcode】33. Search in Rotated Sorted Array

Difficulty:hardSuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found

2016-09-20 00:27:18 298

原创 【leetcode】162. Find Peak Element

Difficulty:mediumA peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may

2016-09-20 00:14:58 324

原创 【leetcode】120. Triangle

Difficulty:mediumGiven 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[

2016-09-14 12:15:46 285

原创 【leetcode】80. Remove Duplicates from Sorted Array II

Difficulty:MediumFollow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function should return length

2016-09-14 12:04:50 200

原创 318. Maximum Product of Word Lengths

Difficulty:MediumGiven a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will

2016-09-13 23:53:16 329

原创 383. Ransom Note

Difficulty:easyGiven
 an 
arbitrary
 ransom
 note
 string 
and 
another 
string 
containing 
letters from
 all 
the 
magazines,
 write 
a 
function 
that 
will 
return 
true 
if 
the 
ransom 
 not

2016-09-12 23:43:35 296

原创 387. First Unique Character in a String

Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2.Note:

2016-09-12 23:36:28 209

原创 【leetcode】312. Burst Balloons

Difficulty:HardGiven 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 the you burst ballo

2016-09-06 23:12:10 281

原创 【leetcode】167. Two Sum II - Input array is sorted

Difficulty:MediumGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indi

2016-09-05 23:34:29 310

原创 【leetcode】347. Top K Frequent Elements

Difficulty:mediumGiven a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always v

2016-09-05 23:17:51 350

原创 【leetcode】Missing Number

Difficulty:mediumGiven an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:

2016-09-05 23:03:06 191

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

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