题意:出一颗树,有两种操作:1. mark u 标记结点u2.query u 询问离u最近的且被标记的祖先结点是哪个让你输出所有询问的和。 思路:数据量太小,直接暴力dfs就可以了 #include<iostream> #include<cstdio> #include<cstdlib> #incl ...
分类:
其他好文 时间:
2017-08-05 09:59:06
阅读次数:
131
https://stablekernel.com/view-controller-in-ios-6/ Some of you may have noticed that your view controller in iOS 6 no longer gets sent to viewWillUnlo ...
分类:
其他好文 时间:
2017-08-04 18:21:27
阅读次数:
138
RDD RDD初始參数:上下文和一组依赖 abstract class RDD[T: ClassTag]( @transient private var sc: SparkContext, @transient private var deps: Seq[Dependency[_]] ) exten ...
分类:
其他好文 时间:
2017-08-04 12:53:26
阅读次数:
189
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia ...
分类:
其他好文 时间:
2017-08-03 21:50:25
阅读次数:
124
In the 2020 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 ...
分类:
其他好文 时间:
2017-08-02 13:54:24
阅读次数:
171
mismatch到底只是一个碱基替换,还是也包括了插入缺失? If two sequences in an alignment share a common ancestor, mismatches can be interpreted as point mutations and gaps as ... ...
分类:
其他好文 时间:
2017-08-01 11:11:22
阅读次数:
180
1.求最低公共祖先LCA( Lowest Common Ancestor ) 什么是最低公共祖先?例如以下图。2与3的LCA是1;1与4的LCA是1;4与5的LCA是2。 那么给定两个节点n1和n2,如今要找出它们的LCA,怎样找?首先分析一下,n1和n2有几种情况?第一种。n1和n2分别在一个节点 ...
分类:
其他好文 时间:
2017-07-31 18:56:02
阅读次数:
168
Problem Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 ...
分类:
其他好文 时间:
2017-07-31 12:39:03
阅读次数:
148
一、若二叉树为搜索二叉树 原题链接:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/#/description Given a binary search tree (BST), find th ...
分类:
其他好文 时间:
2017-07-27 15:54:31
阅读次数:
170
Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains numberi?×?j. The ...
分类:
其他好文 时间:
2017-07-26 20:28:10
阅读次数:
142