Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get...
分类:
其他好文 时间:
2014-12-15 17:25:36
阅读次数:
212
Sort ListSort a linked list inO(nlogn) time using constant space complexity.这道题我想过用直接插入,超时了。百度了一下,用的是归并排序,排序以前用的都是数组,这次用链表,不太习惯参考:http://blog.csdn.net...
分类:
其他好文 时间:
2014-12-15 00:06:08
阅读次数:
238
本题最机巧的O(n)解法最早由1337c0d3r于2013.11.26发布在leetcode。之后看到类似的,都系转载、引用或抄袭。(原文:https://oj.leetcode.com/discuss/857/constant-space-solution)
大多数转载都写得语焉不详,有的甚至据为己有。本帖旨在全面解析该算法。
如下:
int singleNumber(int A[], i...
分类:
其他好文 时间:
2014-12-14 14:40:03
阅读次数:
161
题目:
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K = 3, then you must output 3→2...
分类:
其他好文 时间:
2014-12-13 21:53:24
阅读次数:
326
常用的常量配置 struts.serve.static.browserCache 该属性设置浏览器是否缓存静态内容。当应用处于开发阶段时,我们希望每次请求都获得服务器的最新响应,则可设置该属性为false。 struts.enable.DynamicMethodInvocation 该属性设置Str...
分类:
其他好文 时间:
2014-12-13 21:46:44
阅读次数:
193
--常量 常量的定义使用define()函数,获取常量的两种方法一是直接使用常量名,二是使用 constant()函数。判断一个常量是否已经定义了使用defined()函数。 常见的预定义常量: __FILE__:主配置文件路径 PHP_VERSION:当前PHP版本 PHP_OS:当前系统类型--...
分类:
其他好文 时间:
2014-12-13 17:47:35
阅读次数:
121
先安装deepin-ui,建议安装最新版本 http://packages.linuxdeepin.com/deepin/pool/main/d/deepin-ui/再安装deepin-screenshot http://packages.linuxdeepin.com/deepin/pool/ma...
分类:
系统相关 时间:
2014-12-12 23:27:28
阅读次数:
1411
cc.pool的使用场景
经常创建和销毁的元素,例如打飞机游戏里面的子弹等。不适用的场景:不是很经常创建的物体,比如背景,建筑等。
如何使用cc.pool
让你的类支持cc.pool
首先,你需在需要使用cc.pool来管理的类中实现reuse和unuse方法,cc.pool在执行putInPool时将调用该对象的unuse方法,可以在unuse中完成进入回收池前的操作,r...
分类:
Web程序 时间:
2014-12-12 22:14:25
阅读次数:
295
去这里下载lightworks:http://down.tech.sina.com.cn/page/61988.html去这里下载libtiff4依赖包:http://security.ubuntu.com/ubuntu/pool/main/t/tiff/libtiff4_3.9.5-2ubuntu...
分类:
系统相关 时间:
2014-12-12 22:08:17
阅读次数:
656
As you know, Maya provides class MThreadPool to help develop tocreate or reuse a thread pool, if you want to know more about this, you can reference t...
分类:
其他好文 时间:
2014-12-12 18:35:38
阅读次数:
248