码迷,mamicode.com
首页 >  
搜索关键字:same-tree    ( 180个结果
[leetcode-100-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 identical a ...
分类:其他好文   时间:2017-02-25 18:41:24    阅读次数:153
Leetcode 100. Same Tree
思路1: 递归,如果 p = q, 那么判段 sameTree(p.left)==sameTree(q.left) and sameTree(p.right) = sameTree(q.right) 思路二: 如果两个树相同,说明按照一定的方式遍历这两个树,应该得到一样的结果。这里用的方法是使用st ...
分类:其他好文   时间:2017-01-25 07:44:44    阅读次数:200
100. 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 identi ...
分类:其他好文   时间:2016-12-24 09:28:39    阅读次数:215
Leetcode-100 Same Tree
#100. 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 structur ...
分类:其他好文   时间:2016-11-20 18:35:46    阅读次数:116
100. Same Tree (Tree;DFS)
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 identical an ...
分类:其他好文   时间:2016-11-15 00:24:23    阅读次数:147
复习2
190. Reverse Bits:原数向右移动,如果bit是1,就给结果在相应的位置加上1. 46. Permutations:最适合这道题的dfs搜索顺序是把加一个限制条件:搜索过的数字跳过。脑子里面有个tree的模型然后去想应该搜索的顺序和条件。 100. Same Tree: 递归:检查是不 ...
分类:其他好文   时间:2016-10-09 07:21:39    阅读次数:153
LeetCode 100. 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 identical a ...
分类:其他好文   时间:2016-09-16 21:03:29    阅读次数:153
100. Same Tree
思路:递归。 null也是tree。 null tree (definition) Definition: (1) A tree which is empty. (2) A tree whose leaf nodes all have a null value. https://xlinux.nis ...
分类:其他好文   时间:2016-09-10 06:44:29    阅读次数:165
学习笔记:LeetCode176:
LeetCode176: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 st ...
分类:其他好文   时间:2016-09-08 20:05:57    阅读次数:91
[leetcode] 100. 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 identical a ...
分类:其他好文   时间:2016-09-05 00:09:14    阅读次数:94
180条   上一页 1 ... 4 5 6 7 8 ... 18 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!