数据结构
jjfly
无他,唯手熟尔
展开
-
二叉树的非递归遍历
先是中序遍历 /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ ...原创 2015-01-21 21:37:45 · 614 阅读 · 0 评论 -
Count and Say
The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one 2原创 2015-03-09 15:09:27 · 504 阅读 · 0 评论 -
Binary Tree Paths
Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1->2->5", "1->3"] /** * Definiti原创 2015-08-22 16:53:11 · 531 阅读 · 0 评论 -
First Bad Version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the原创 2015-09-09 15:58:30 · 423 阅读 · 0 评论