2016-06-06 craneyuan
Question Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Note: Given n will always be valid. Try to do this in one pass. 解说 这道题的意思是,如何反向删 继续阅读 »
2013-11-14 veryyoung
public class ArrayOperation { /** 归并排序,ints为要进行排序的数组,temp为临时数组,start为排序起点,end为排序终点,排序范围为[start,end] */ private static void guibingSort(int[] ints, int[] temp, int start, int end) { if(start >= end) return; int middle = (start + end) / 2;//中间点 int left = start;//左边起点 继续阅读 »
2016-06-24 MoreFreeze
上周读完了阿西莫夫的《永恒的终结》,感觉文章的思路非常神奇,说下对这书的感受。 先解释下背景,永恒时空是在27世纪成立的,它独立于时间线之外, 相当于一个时间线的警察局,对于正统时间线的问题(比如发生核爆啦)进行修正, 从而向着永恒时空“想要”的方向发展。 永恒时空会从各个世纪挑选人才,培训他们进入永恒时空工作。 永恒时空工种大体从低到高分为以下几种: 继续阅读 »
2016-07-11 Oliver Wang
之前写过一遍介绍 splice() 方法的,这一次又遇到了 slice(), 这两个太像了, 首先看这两个意思吧: splice [splais] n. 接合;结婚 vt. 拼接;接合;使结婚 和 slice [slais] n. 薄片;部分;菜刀,火铲 vt. 切下;把…分成部分;将…切成薄片 vi. 切开;割破 区别 slice() 方法可从已有的数组中返回选定的元素。这个函数有两个参数 slice(start, end) 会返回一个从 start 到 end 之前元素的新数组, 如果 end 是负数,就从数组末尾倒着数, 如果 end 没有设置,就返回从 start 到数组末尾组成的新数组咯~ 总之这是一个返回 继续阅读 »
2016-01-10 LEo
1 检测系统是否win7 pascal function CheckWin7(): Boolean; begin GetWindowsVersionEx(Version); if Version.Major = 6 then begin Result := True; end else begin Result := False; end; end; 2 检测是否是silent安装 继续阅读 »
2016-12-14 ruki
lua原生并没有提供try-catch的语法来捕获异常处理,但是提供了pcall/xpcall等接口,可在保护模式下执行lua函数。 因此,可以通过封装这两个接口,来实现try-catch块的捕获机制。 我们可以先来看下,封装后的try-catch使用方式: ```lua try { -- try 代码块 function () error("error message") end, -- catch 代码块 catch { -- 发生异常后,被执行 function (errors) print(errors) end } } ``` 上面 继续阅读 »
2014-10-26 Xie Jingyi
测试位置:WikiOI1078 type TEdge = record start, terminal: longint; weight: int64; end; TEdgeArr = array of TEdge; operator (e1, e2: TEdge)res: Boolean; begin res := e1.weight > e2.weight; end; procedure SortEdge(A: TEdgeArr; l, r: longint); var i, j: longint; t, m: TEdge; begin 继续阅读 »
2016-05-07 YongHao Hu
C++
在C++03中, 标准容器提供了begin与end函数 vector v; int a[100]; sort(v.begin(), v.end()); sort(a, a+sizeof(a)/sizeof(a[0])); 为了统一数组跟容器的语法, C++11提供了begin()函数 继续阅读 »
2017-08-11 AnnatarHe
众所周知,Nginx 使用 异步, 事件驱动来接收连接。这就意味着对于每个请求不会新建一个专用的进程或者线程(就像传统服务端架构一样),它是在一个工作进程中接收多个连接和请求。为了达成这个目标,Nginx 用在一个非阻塞模式下的 sockets 来实现,并使用例如 epoll 和 kqueue 这样高效的方法。 继续阅读 »
2019-01-10 Alex Sun
一、Hello World 使用镜像的代码为: ```js const http = require('http') const os = require('os') const hostname = os.hostname() const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }) res.end(Hello world from ${hostname}) }) 继续阅读 »