[置顶] C++中变量命名规范

摘要: 变量命名有许多约定俗成的规范,如下的一些规范能够有效的提高程序的可读性: 阅读全文

posted @ 2017-02-16 20:38 xdzhanght 阅读(297) 评论(0) 推荐(0) 编辑

2017年6月25日

★leetcode★ same-tree

摘要: 题目要求: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally ident 阅读全文

posted @ 2017-06-25 11:55 xdzhanght 阅读(130) 评论(0) 推荐(0) 编辑

2017年6月23日

[leetcode] construct-binary-tree-from-preorder-and-inorder-

摘要: 题目描述 Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. Given p 阅读全文

posted @ 2017-06-23 23:13 xdzhanght 阅读(170) 评论(0) 推荐(0) 编辑

[leetcode] construct-binary-tree-from-inorder-and-postorder-

摘要: 题目描述 Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. Given 阅读全文

posted @ 2017-06-23 22:55 xdzhanght 阅读(112) 评论(0) 推荐(0) 编辑

2017年6月22日

★leetcode★ reorder-list

摘要: 题目: Given a singly linked list L: L 0→L 1→…→L n-1→L n,reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→… You must do this in-place without altering the nod 阅读全文

posted @ 2017-06-22 17:01 xdzhanght 阅读(146) 评论(0) 推荐(0) 编辑

2017年5月31日

已知二叉树的后序和中序,求前序遍历

摘要: 参考博客http://blog.csdn.net/baidu_21578557/article/details/51175149 (已知二叉树的前序和中序,求后序) 和上面博客几乎完全一样,哈哈哈(偷笑) 大概思路: 阅读全文

posted @ 2017-05-31 22:05 xdzhanght 阅读(971) 评论(0) 推荐(0) 编辑

2017年5月11日

lambda表达式

摘要: 定义: 一个lambda表达式表示一个可调用的代码单元。我们可以将其理解为一个未命名的内联函数。与任何函数类似,一个lambda具有一个返回类型,一个参数列表和一个函数体。但与函数不同,lambda可以定义在函数内部。一个lambda表达式具有如下形式 [capture list](paramete 阅读全文

posted @ 2017-05-11 11:29 xdzhanght 阅读(347) 评论(0) 推荐(0) 编辑

2017年4月6日

编程(用%20替换空格)

摘要: 题目描述 请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 阅读全文

posted @ 2017-04-06 15:06 xdzhanght 阅读(154) 评论(0) 推荐(0) 编辑

2017年3月30日

二叉树镜像

摘要: 题目描述 操作给定的二叉树,将其变换为源二叉树的镜像。 输入描述: 二叉树的镜像定义:源二叉树 8 / \ 6 10 / \ / \ 5 7 9 11 镜像二叉树 8 / \ 10 6 / \ / \ 11 9 7 5 1 /* 2 struct TreeNode { 3 int val; 4 st 阅读全文

posted @ 2017-03-30 22:26 xdzhanght 阅读(262) 评论(0) 推荐(0) 编辑

重建二叉树

摘要: 题目描述 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。 阅读全文

posted @ 2017-03-30 21:58 xdzhanght 阅读(92) 评论(0) 推荐(0) 编辑

2017年3月23日

DNA合成

摘要: DNA分子是以4种脱氧核苷酸为单位连接而成的长链,这4种脱氧核苷酸分别含有A,T,C,G四种碱基。碱基互补配对原则:A和T是配对的,C和G是配对的。如果两条碱基链长度是相同的并且每个位置的碱基是配对的,那么他们就可以配对合成为DNA的双螺旋结构。现在给出两条碱基链,允许在其中一条上做替换操作:把序列 阅读全文

posted @ 2017-03-23 17:23 xdzhanght 阅读(156) 评论(0) 推荐(0) 编辑

导航