摘要:
题目的大意是:进行一系列的操作push,pop。来确定后序遍历的顺序 An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that 阅读全文
摘要:
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. Input Specification: Each input file contains one t 阅读全文
摘要:
假设有从 1 到 N 的 N 个整数,如果从这 N 个数字中成功构造出一个数组,使得数组的第 i 位 (1 <= i <= N) 满足如下两个条件中的一个,我们就称这个数组为一个优美的排列。条件: 现在给定一个整数 N,请问可以构造多少个优美的排列? 示例1: 说明: 参考博客:Beautiful 阅读全文