mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-14 16:14:52 +08:00
17 lines
286 B
Go
17 lines
286 B
Go
package leetcode
|
|
|
|
/**
|
|
* Definition for a binary tree node.
|
|
* type TreeNode struct {
|
|
* Val int
|
|
* Left *TreeNode
|
|
* Right *TreeNode
|
|
* }
|
|
*/
|
|
func isSymmetric(root *TreeNode) bool {
|
|
if root == nil {
|
|
return true
|
|
}
|
|
return isSameTree(invertTree(root.Left), root.Right)
|
|
}
|