摘要:
将一棵无穷大满二叉树的结点按根结点一层一层地从左往右编号,根结点编号为1。 现给定a,b为两个结点。设计一个算法,返回a、b最近的公共祖先的编号。 注意其祖先也可能是结点本身。 class LCA { public: int getLCA(int a, int b) { while(a!=b){ i 阅读全文
摘要:
1.输入两个字符串,从第一个字符串中删除第二个字符串中所有的字符. 例如输入 they are students. aeiou 结果 thy r stdnts. #include<iostream> #include<string> using namespace std; int main(){ 阅读全文