ltree

package
v0.0.0-...-d229d73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

https://leetcode.com/problems/increasing-order-search-tree/

Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, \ and every node has no left child and only 1 right child.

Example 1: Input: [5,3,6,2,4,null,8,1,null,null,null,7,9]

      5
     / \
   3    6
  / \    \
 2   4    8
/        / \

1 7 9

Output: [1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9]

1
 \
  2
   \
    3
     \
      4
       \
        5
         \
          6
           \
            7
             \
              8
               \
                9

Note:

	The number of nodes in the given tree will be between 1 and 100.
	Each node will have a unique integer value from 0 to 1000.

 https://leetcode.com/problems/same-tree/#/description

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 and the nodes have the same value.

https://leetcode.com/problems/leaf-similar-trees/

Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence.

https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/16/tree.png

For example, in the given tree above, the leaf value sequence is (6, 7, 4, 9, 8).

Two binary trees are considered leaf-similar if their leaf value sequence is the same.

Return true if and only if the two given trees with head nodes root1 and root2 are leaf-similar.

https://leetcode.com/problems/path-sum-ii/description/

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.

For example:

Given the below binary tree and sum = 22,
              5
             / \
            4   8
           /   / \
          11  13  4
         /  \    / \
        7    2  5   1
return
[
   [5,4,11,2],
   [5,8,4,5]
]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

func (*ListNode) String

func (l *ListNode) String() string

type Node

type Node struct {
	Val      int
	Children []*Node
}

type TreeNode

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

*

  • Definition for a binary tree node.

func (*TreeNode) String

func (t *TreeNode) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL