原文:[LeetCode] 100. Same Tree 判斷相同樹

Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical and the nodes have the same value. Example : ...

2014-10-27 07:54 5 10709 推薦指數:

查看詳情

[leetcode]Same Tree @ Python

原題地址:https://oj.leetcode.com/problems/same-tree/ 題意:判斷兩棵是否是同一棵。 解題思路:這題比較簡單。用遞歸來做。首先判斷兩個根節點的值是否相同,如果相同,遞歸判斷根的左右子樹。 代碼: ...

Fri May 23 18:51:00 CST 2014 0 3413
[LeetCode] Symmetric Tree 判斷對稱

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric ...

Sun Oct 26 18:49:00 CST 2014 17 12959
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM