1.前言 最近公共祖先(Least Common Ancestors),简称LCA,是由Tarjan教授(对,又是他)提出的一种在有根树中,找出某两个结点u和v最近的公共祖先问题。 2.什么是最近公共祖先? 在一棵树中,每个结点都有他的父亲和祖先,而最近公共祖先就是两个节点在这棵树上深度最大的公共的 ...
分类:
编程语言 时间:
2017-11-02 22:04:59
阅读次数:
212
什么是Nginx Nginx (“engine x”) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。Nginx是由Igor Sysoev为俄罗斯访问量第二的Rambler.ru站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD ...
分类:
系统相关 时间:
2017-11-02 11:27:06
阅读次数:
301
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2, ...
分类:
其他好文 时间:
2017-11-01 17:25:34
阅读次数:
142
官方文档的解释如下: stack: Join a sequence of arrays along a new axis concatenate: Join a sequence of arrays along a existing axis 因此stack 是在新轴axis=n上加入矩阵,已有的a ...
分类:
其他好文 时间:
2017-10-28 21:07:57
阅读次数:
530
Find the Duplicate Number Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one dup ...
分类:
编程语言 时间:
2017-10-28 18:56:35
阅读次数:
228
整理一些树的,基本的,简单的一些知识。 先写一下关于树的定义,相关术语。 树,父节点、子节点、子树、祖先、兄弟、根节点、叶节点、直径、路径、重心、直径、最近公共祖先、生成树、dfs序,树形dp等 1、最近公共祖先 一般用倍增求LCA(Least Common Ancestors)。 按照朴素的做法, ...
分类:
其他好文 时间:
2017-10-27 13:14:23
阅读次数:
138
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 endpo ...
分类:
其他好文 时间:
2017-10-26 15:26:39
阅读次数:
197
1282 - Leading and Trailing You are given two integers: n and k, your task is to find the most significant three digits, and least significant three d ...
分类:
其他好文 时间:
2017-10-20 11:55:22
阅读次数:
185
Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that ...
分类:
其他好文 时间:
2017-10-20 11:52:11
阅读次数:
139
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the ...
分类:
其他好文 时间:
2017-10-19 21:16:10
阅读次数:
266