一次过,空间复杂度为O(m+n), 下一次做的时候寻找constant space
solution。用boolean array也可以,用bit vector可能会更节省 1 import java.util.*; 2 3 public
class Solution { 4 public...
分类:
其他好文 时间:
2014-05-23 08:30:28
阅读次数:
278
一个基本的该类型字符串例子:@"This is a constant character
string object";在后台显示它:NSLog (@"%@", @"This is a constant character string
object");得到其长度:int len = [@"Hel...
分类:
其他好文 时间:
2014-05-19 13:59:33
阅读次数:
234
【题目】
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
For example,
Given input array A ...
分类:
其他好文 时间:
2014-05-18 18:25:19
阅读次数:
272
【题目】
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 use only constant space. You may not modify the values in the list, only nodes it...
分类:
其他好文 时间:
2014-05-18 08:37:57
阅读次数:
370
题目: Sort a linked list inO(nlogn) time using
constant space complexity.解题思路: 复杂度为O(n* logn)
的排序算法有:快速排序、堆排序、归并排序。对于链表这种数据结构,使用归并排序比较靠谱。递归代码如下:代码: /...
分类:
其他好文 时间:
2014-05-16 05:49:04
阅读次数:
266
The Chef likes to stay in touch with his staff. So, the Chef, the head server, and the sous-chef all carry two-way transceivers so they can stay in constant contact. Of course, these transceivers have...
分类:
其他好文 时间:
2014-05-10 09:11:21
阅读次数:
334
今天遇到HPE_INVALID_CONSTANT 错误.1. 再现今天下午调用同事的接口,
莫名出现该异常.一直在找原因.以下是http.get 代码.. 没发现问题,且该方法调用其他接口没问题. http.get(_options.url,
function (res) { var ...
分类:
Web程序 时间:
2014-05-09 07:33:33
阅读次数:
2969
In file included from mod_shib_20.cpp:68:
mod_shib.cpp:118: warning: deprecated conversion from string constant to 'char*'
mod_shib.cpp: In member function 'virtual const char* ShibTargetApache::get...
分类:
其他好文 时间:
2014-05-07 06:04:50
阅读次数:
363
用AngularJS做项目,但凡用过什么service啊,factory啊,provider啊,开始的时候晕没晕?!晕没晕?!感觉干的事儿都差不多啊,到底用哪个啊?!别告诉我你们几个就是为了跟我炫耀兄弟多!!好吧。。。也许是我的问题,脑仁儿确实不够大,反正我是晕的直挠墙~那到底什么时候该请他们谁出场...
分类:
Web程序 时间:
2014-05-07 02:16:08
阅读次数:
543
public function index(){
header('Content-Type:text/html;charset=utf-8 ');
$M = M("Constant");
$count = $M->where($where)->count();
import("ORG.Util.Page"); // 导入分页类
...
分类:
Web程序 时间:
2014-04-30 22:27:39
阅读次数:
343