自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 算法 第八章习题 8.12

习题8.12题目:输入:无向图G=(V,E),输出:G的一个生成树,其中所有点度数不超过k——如果这样的树存在。 给定K大于等于2。a:k-生成树问题是一个搜索问题。 b:k-生成树问题是NP-完全的。(提示:由k=2开始,考虑与Rudrata路径问题的关联)solution:a:搜索问题的特征性定义是:任何可能解的正确性都能被快速检验。则用图搜索算

2017-07-14 20:50:02 324

原创 【LeetCode】13. Roman to Integer

Description:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题目分析:题目要求罗马数字转化为整型数字,查询罗马特殊字符:I          1V        5

2017-06-21 09:03:53 216

原创 【LeetCode】9. Palindrome Number

Description:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Subscribe to see which companies asked this question.题目分析:判断是否是回文数,

2017-06-21 08:42:37 201

原创 【LeetCode】5. 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.Example:Input: "babad"Output: "bab"Note: "aba" is also a

2017-06-21 08:34:47 218

原创 【LeetCode】38.Combination Sum

Description:Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated num

2017-06-15 18:57:19 281

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

Description:There 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)).Exam

2017-06-15 15:09:34 246

原创 【LeetCode】53. Maximum Subarray

Description: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 suba

2017-06-15 14:25:14 203

原创 【LeetCode】51. N-Queens

Description:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the

2017-06-15 09:37:06 287

原创 【LeetCode】115.Distinct Subsequences

Description:Given a string S and a string T, count the number of distinct subsequences of S which equals T.A subsequence of a string is a new string which is formed from the original string

2017-06-15 09:09:16 332

原创 【LeetCode】132.Palindrome Partitioning II

Description:Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given 

2017-06-15 09:02:19 290

原创 【LeedCode】96. Unique Binary Search Trees

Description: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 3 3

2017-06-14 09:00:26 238

原创 【LeedCode】128.Longest Consecutive Sequence

Description:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements se

2017-06-14 08:44:28 248

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

Description: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 one and sell one sh

2017-04-25 11:12:47 260

原创 【LeedCode】78.Subset

Description:Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution

2017-04-25 10:57:11 235

原创 【LeedCode】120. Triangle

Description: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-04-25 10:48:36 253

原创 【LeetCode】130. Surrounded Regions

Description:Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded reg

2017-04-01 18:41:17 186

原创 【LeetCode】133. Clone Graph

Description:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a

2017-03-20 14:35:03 265

原创 【LeetCode】88. Merge Sorted Array

Description:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n)

2017-03-14 13:39:45 216

原创 【LeetCode】108. Convert Sorted Array to Binary Search Tree

Description:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题目要求:给定一个数组,其中的元素按升序排序,将它转换成一个高度平衡的二叉查找树。题目分析:使用分治算法思想将数组分为两个子数组,分别为左子树和右子树,中间值作为左右子树

2017-03-03 19:12:45 198

原创 【LeetCode】1. Two Sum

Description: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

2017-02-27 22:58:33 229

空空如也

空空如也

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

TA关注的人

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