自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 8.15最大公共子图

证明如下问题是NP-完全的:输入:两个图G1=(V1,E1)和G2=(V2,E2);预算b输出:两个节点集合V1‘属于V1,V2'属于V2,它们被移除后,将在两图中分别留下至少b个节点,且图的剩余部分完全一样。可以将独立集问题归约到此问题。比如若要求任意图G(V,E)中大小为d的独立集,可以令G1=G(V,E),再令G2(V,Ø)的顶点集与G相同,但是边集为空,也即是各个顶点相

2017-12-31 23:24:15 491

原创 14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.分析如果数组长度为1,最长前缀就是strs[0]。如果数组长度为2,从头部开始,比较两个字符串的每个字符,当不相等时,返回最长前缀。如果数组长度>2,将数组分为左右两部分,找出左半部分、右半部分的最长前缀,找出这

2017-12-15 14:44:53 114

原创 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 the you burst balloon i you will get num

2017-12-15 14:36:58 114

原创 5. Longest Palindromic Substring

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.

2017-12-15 14:23:46 107

原创 241. Different Ways to Add Parentheses

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Example 1

2017-12-15 14:16:22 152

原创 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 substring is "()", wh

2017-12-15 00:19:41 121

原创 240. Search a 2D Matrix II

Write 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 in ascending from left to right.Integers in

2017-12-07 01:19:21 98

原创 169. Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2017-12-06 23:12:22 120

原创 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,-1,2,1] ha

2017-12-06 22:35:51 113

原创 730. Count Different Palindromic Subsequences

Given a string S, find the number of different non-empty palindromic subsequences in S, and return that number modulo 10^9 + 7.A subsequence of a string S is obtained by deleting 0 or more chara

2017-12-04 21:46:53 234

原创 673. Number of Longest Increasing Subsequence

Given an unsorted array of integers, find the number of longest increasing subsequence.Example 1:Input: [1,3,5,4,7]Output: 2Explanation: The two longest increasing subsequence are [1, 3, 4,

2017-12-04 20:31:53 126

原创 689. Maximum Sum of 3 Non-Overlapping Subarrays

In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum.Each subarray will be of size k, and we want to maximize the sum of all 3*k entries.Return t

2017-12-04 18:09:51 135

空空如也

空空如也

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

TA关注的人

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