自定义博客皮肤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)
  • 问答 (1)
  • 收藏
  • 关注

原创 [算法概论 8.12 k-生成树问题]

一、题目输入:无向图G:=(V,E)输出:G的一个生成树,其中所有节点度数都不超过K-如果该树存在题目a:k-生成树问题是一个搜索问题。 题目b:k-生成树问题是NP-完全的。(提示:由k=2开始,考虑与Rudrata路径问题的关联)二、证明a.给出一个G的待确定生成树,想要判断该生成树是否为满足要求的k-生成树,只需要遍历每个节点去

2017-07-07 02:31:52 459

原创 [leetcode Maximum Subarray]week 19

一、题目Findthe contiguous subarray within an array (containing at least one number) whichhas the largest sum. For example, given the array [-2, 1, -3, 4, -1, 2, 1,-5, 4], the contiguous subarray [4, -1

2017-07-07 02:11:39 191

原创 [leetcode Best Time to Buy and Sell Stock]week 18

一、题目Say you have an array for which the ith elementis the price of a given stock on day i.If you were onlypermitted to complete at most one transaction (ie, buy one and sell one shareof the stock)

2017-07-07 02:05:47 179

原创 [leetcode Search Insert Position]week 17

一、题目Given a sorted array and a target value,return the index if the target is found. If not, return the index where itwould be if it were inserted in order.You may assume no duplicates in the arra

2017-07-07 02:03:16 167

原创 [leetcode Merge Two Sorted Lists]week 15

一、题目Merge two sorted linked lists and return itas a new list. The new list should be made by splicing together the nodes ofthe first two lists.二、代码class Solution {public:   ListNode* m

2017-07-07 02:02:29 142

原创 [leetcode 19 Remove Nth Node From End of List]week 13

一、题目Given a linked list, remove the nth nodefrom the end of list and return its head.For example, Given linked list: 1->2->3->4->5,andn = 2.After removing the second node from the end,

2017-07-07 02:01:14 156

原创 [leetcode 50. Pow(x, n)]week 11

一、题目Implement pow(x, n).二、代码class Solution {public:   double myPow(double x, int n) {       if (n           double tmp=myPower(x,-n);           return 1.0/tmp;       }       el

2017-07-07 01:59:41 152

原创 [leetcode 55. Jump Game]week 7

一、题目Given anarray of non-negative integers, you are initially positioned at the first indexof the array.Each element in the array represents your maximum jumplength at that position.Determine

2017-07-07 01:58:41 173

原创 [leetcode 104. Maximum Depth of Binary Tree]week 5

一、题目Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from theroot node down to the farthest leaf node.二、代码class Solution {pub

2017-07-07 01:56:33 142

原创 [leetcode 204. Count Primes]week 3

一、题目Description:Count the number of prime numbers less than a non-negative number, n.二、代码class Solution {public:   int countPrimes(int n) {       int count=0;       if (n      

2017-07-07 01:55:27 136

原创 [lleetcode 121. Best Time to Buy and Sell Stock]|week 16

Best Time to Buy and Sell Stock一、题目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

2017-06-10 12:13:53 199

原创 [leetcode contest 582. Kill Process]week 14

一、题目Given n processes, each process has a unique PID (process id) and its PPID (parent process id).Each process only has one parent process, but may have one or more children processes. This is just li

2017-05-26 09:21:51 328

原创 [leetcode 413. Arithmetic Slices]medium|week 12

一、题目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 are arithmetic sequence

2017-05-13 21:06:01 235

原创 [leetcode 377. Combination Sum IV]medium|week10

一、题目Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3] target = 4The possibl

2017-04-30 12:11:33 165

原创 [leetcode 392. Is Subsequence]medium|week 9

一、题目Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string

2017-04-21 09:16:04 179

原创 [leetcode 435. Non-overlapping Intervals] medium|week 8

一、题目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 interval’s end point is always b

2017-04-14 16:08:23 253

原创 [leetcode 513. Find Bottom Left Tree Value]medium | week6

一、题目Given a binary tree, find the leftmost value in the last row of the tree.Example 1: Input:2/ \ 1 3Output: 1 Example 2: Input: 1 / \ 2 3 / / \4 5 6 / 7Output: 7二、

2017-03-31 10:59:32 284

原创 [leetcode 169. Majority Element]easy |week4

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 always

2017-03-19 11:20:32 206

原创 [leetcode 312. Burst Ballons] hard |week 2

Burst Ballons一、题目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

2017-03-05 00:28:41 318

原创 [leetcode 42. Trapping Rain Water] Hard | Week 1

Trapping Rain Water一、题目Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,

2017-02-22 19:40:44 163

空空如也

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

TA关注的人

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