Design and implement a data structure for Least
Recently Used (LRU) cache. It should support the following
operations:getandset.get(key)- Get the valu...
分类:
其他好文 时间:
2014-05-23 09:59:05
阅读次数:
257
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these children subjected to the following requirements:
Each child must have at least one candy.
Children with a higher rating get more candies than...
分类:
其他好文 时间:
2014-05-22 11:00:49
阅读次数:
285
简介
此文档描述了一个超级用户如何在安全的方式下以另一用户的名义提交作业或访问hdfs。
Use Case
下一部分描述的的代码示例对此用户用例是可用的。
一个用户名为'super'的超级用户想要以另一用户joe的名义提交作业或访问hdfs。超级用户有kerberos证书但是用户joe并没有。任务要求以用户joe的角色运行并且namenode上的文件访问也需要由joe完成。需要用户...
分类:
其他好文 时间:
2014-05-22 10:40:41
阅读次数:
255
本文参考《Android系统源代码情景分析》,作者罗升阳
一、测试代码:
~/Android/external/binder/server
----FregServer.cpp
~/Android/external/binder/common
----IFregService.cpp...
分类:
移动开发 时间:
2014-05-22 10:27:56
阅读次数:
367
找出单词的最长公共前缀
class Solution {
public:
string longestCommonPrefix(vector &strs) {
int len=strs.size();
if(len==0)
return "";
int length=strs[0].size(),j;
...
分类:
其他好文 时间:
2014-05-22 09:35:20
阅读次数:
230
CGI
CGI全称是“公共网关接口”(Common Gateway Interface),HTTP服务器与你的或其它机器上的程序进行“交谈”的一种工具,其程序须运行在网络服务器上。
CGI可以用任何一种语言编写,只要这种语言具有标准输入、输出和环境变量。如php,perl,tcl等。
FastCGI
FastCGI像是一个常驻(long-live)型的CGI,它可以一直执行着,只要激活后,不会每次都要花费时间去fork一次(这是CGI最为人诟病的fork-and-execute 模式)。它还支持分布...
分类:
Web程序 时间:
2014-05-22 09:31:44
阅读次数:
340
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:
get and set.
get(key) - Get the value (will always be positive) of the key if t...
分类:
其他好文 时间:
2014-05-22 07:25:32
阅读次数:
254
leetcode上刷题。碰到一题实现LRU算法的题目。LRU,Least recently
used。是一种常见的cache和页面替换算法。算法和原理可以参阅相关wiki。leetcode上的这一题,时间要求很苛刻,如果达不到O(1)复杂度的话,基本上会TLE。所以,这一题如果用C++来解的话,需要...
分类:
编程语言 时间:
2014-05-22 03:34:16
阅读次数:
353
Find common nodes of 2 linked list.
分类:
其他好文 时间:
2014-05-22 00:10:17
阅读次数:
241