上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 29 下一页
摘要: Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be 阅读全文
posted @ 2015-10-20 19:31 eversliver 阅读(216) 评论(0) 推荐(0) 编辑
摘要: Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 阅读全文
posted @ 2015-10-20 17:32 eversliver 阅读(281) 评论(0) 推荐(0) 编辑
摘要: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo... 阅读全文
posted @ 2015-10-20 10:10 eversliver 阅读(267) 评论(0) 推荐(0) 编辑
摘要: Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文
posted @ 2015-10-20 09:35 eversliver 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2015-10-19 20:24 eversliver 阅读(297) 评论(0) 推荐(0) 编辑
摘要: Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].将数组的内容倒置,看例子就知道是... 阅读全文
posted @ 2015-10-19 19:23 eversliver 阅读(392) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth... 阅读全文
posted @ 2015-10-19 10:02 eversliver 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 如果operator new接收到的参数除了size_t之外还有其他的话,那么这个operator new实际上就是一个placement new,所以考虑下下面这样的情况:一个可以用来记录信息的placement new:1 class Widget{2 public:3 ...4 ... 阅读全文
posted @ 2015-10-18 17:40 eversliver 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 几种最常见的这么做的理由: 1.用来检测运行上的错误:可以在分配的内存空间的起始以及结束分别放置单独的签名 2.为了强化性能 3.为了收集使用上的统计数据按照第一点就可以举一个例子: 1 static const int signature = 0XDEADBEEF; 2 typedef us... 阅读全文
posted @ 2015-10-18 17:15 eversliver 阅读(256) 评论(0) 推荐(0) 编辑
摘要: C++中delete一个指针之后,只是回收指针指向位置的空间,而指针本身的值不变。你需要手工将其赋值为NULL。注意的一点是delete NULL指针的时候不会有任何的事情发生小结: operator new内应该有个个无穷循环,若在其中无法返回内存需求,就调用new-handler,这里面也应该... 阅读全文
posted @ 2015-10-18 17:15 eversliver 阅读(267) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 29 下一页