这道题真真是在面试中碰到过,可惜当时复杂度到O(n2)了,太挫了,怪不得没有通过面试。
Given n non-negative integers a1, a2,
..., an, where each represents a point at coordinate (i, ai). n vertical
lines are drawn such that the two en...
分类:
编程语言 时间:
2014-10-09 01:58:17
阅读次数:
229
##Reflect Resolution 反射解决方案 One of the most powerful features of the Laravel container is its ability to automatically resolve dependencies via reflection. Reflection is the ability to inspe...
分类:
移动开发 时间:
2014-10-08 23:18:27
阅读次数:
331
Eclipse Kepler?4.3.2 SR2?is the most recent release from the Eclipse top-level project. It contains what you need to build applications based on Eclipse technology, including integrated developm...
分类:
系统相关 时间:
2014-10-08 15:10:55
阅读次数:
457
解法:(1)建立一个二维数组,记录各位置左侧最高点及右侧最高点,可通过O(n)计算得到。
(2)根据上述信息及当前高度,计算该点竖直方向能容纳多少水,仍是O(n)完成。
综上,渐近时间复杂度为O(n);
class Solution {
public:
int trap(int A[], int n) {
if(n
return 0;
int* hi...
分类:
移动开发 时间:
2014-10-07 15:57:53
阅读次数:
181
题目链接:zoj 3471 Most Powerful很经典的状态dp,使用i的二进制位表示粒子的状态,0表示存在,1表示不存在。dp[i]表示在状态i的情况下能够释放的最大的能量,注意自身不能够发生碰撞。例如4个粒子的状态1100表示第0个和第1个粒子不存在,第2、3个粒子存在则可以转移到状态11...
分类:
其他好文 时间:
2014-10-06 20:57:30
阅读次数:
175
The language feature most often associated with object-oriented programming is inheritance. Inheritance is the ability to define a new class that is a...
分类:
其他好文 时间:
2014-10-06 20:32:10
阅读次数:
192
//Given a non-negative number represented as an array of digits, plus one to the number.
//The digits are stored such that the most significant digit is at the head of the list.
//digits={9,9,9,...
分类:
其他好文 时间:
2014-10-06 13:46:10
阅读次数:
200
在os x下,安装完python爬虫框架scrapy后,使用scrapy startproject tutorial新建scrapy项目时,出现以下问题:Traceback (most recent call last): File "/usr/local/bin/scrapy", line 5,....
分类:
其他好文 时间:
2014-10-06 12:32:50
阅读次数:
412
一个int占多少个字节?这个问题我们往往得到的答案是4.可是int究竟占多少个字节,却跟你的机器环境有关.As you can see, the typical data type sizes match the ILP32LL model, which is what most compilers...
分类:
其他好文 时间:
2014-10-06 11:44:30
阅读次数:
211
Chapter 18 Saving, Loading, and Application State1. Archiving is one of the most common ways of persisting model objects on iOS. Archiving an object i...
分类:
移动开发 时间:
2014-10-04 00:03:55
阅读次数:
286