自定义博客皮肤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  The k-SPANNING TREE problem is the following.                           Input: An undirected graph G = (V,E)                            Output: Aspanningtreeof G in which each node has degre

2017-07-05 18:42:43 317

原创 第十九周OJ-Q198解题方法

问题:ou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjace

2017-07-01 22:03:22 378

原创 第十八周OJ-Q152解题方法

问题Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the

2017-07-01 21:57:06 224

原创 第十七周OJ-Q452解题方法

问题: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 it's horizontal,

2017-07-01 21:53:32 222

原创 第十六周OJ-Q134解题方法

问题:There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station 

2017-07-01 21:48:03 409

原创 第十五周OJ-Q118解题方法

问题:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]这也是一个比较经典的问题了,其实就是做个

2017-06-08 17:15:38 476

原创 第十四周OJ-Q83解题方法

问题:Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.这其实是个比较经典的问题了,删除链

2017-06-08 17:04:35 441

原创 第十三周OJ-Q58解题方法

问题:Given a string s consists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2017-06-08 16:49:23 348

原创 第十二周OJ-Q24解题方法

问题:Swap Nodes in Pairs Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should u

2017-06-06 16:02:09 273

原创 第十一周OJ-Q50解题方法

问题:Implement pow(x, n).从题目来看这是个有趣的问题。十分简短。然后我用了1分钟写出如下版本:class Solution { public:     double myPow(double x, int n) {        double res = 1;         for(int i = 0;i            res *=

2017-05-15 14:47:34 303

原创 第十周OJ-Q18解题方法

问题:Given an array S of n integers, are there elements a,b, c, and d in S such that a + b +c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The solut

2017-05-15 14:31:34 273

原创 第九周OJ-Q16解题方法

问题:Given an array S of n integers, find three integers inS such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exa

2017-05-15 14:23:56 208

原创 第八周 OJ-Q15解题方法

Given an array S of n integers, are there elements a,b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain du

2017-05-15 14:08:57 293

原创 第七周OJ-Q1解题方法

题目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 not use the

2017-04-09 22:21:03 277

原创 第六周OJ-Q392解题方法

题目: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 andt. t is potentially a very long (length ~= 500,00

2017-04-09 21:53:53 182

原创 第五周OJ-Q123解题方法

问题:Best Time to Buy and Sell Stock IIISay 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 complet

2017-03-27 21:06:48 296

原创 第四周OJ-Q122解题方法

问题 Best Time to Buy and Sell Stock IISay 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 comple

2017-03-19 20:50:13 211

原创 第三周OJ-Q402解题方法

问题Remove K Digits Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.Note:The length of num

2017-03-14 13:15:09 317

原创 第二周OJ-Q53解题方法

题目: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 contigu

2017-03-06 14:04:20 229

原创 第一周OJ-Q7解题方法

class Solution(object): def reverse(self, x): result = 0 xx = 0 if x0: result = result*10+xx%10 xx = xx/10 if result>=2147483648 or result=0: return result直接上源码,先判断数字符号,然后不停取出输入的最后一位并删除。在resul

2017-02-26 22:58:13 292

空空如也

空空如也

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

TA关注的人

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