Min Li's Note
KVM,QEMU, X86 virtualization
Pages
Home
Collection
About
Thursday, October 2, 2014
Symmetric Tree
Problem
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
But the following is not:
Idea
dfs, 对于每个iteration, 两个pointer分别遍历right_sub和left_sub。 然后比较。
Solution
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment