题目:
题解:
func flatten(root *TreeNode) {curr := rootfor curr != nil {if curr.Left != nil {next := curr.Leftpredecessor := nextfor predecessor.Right != nil {predecessor = predecessor.Right}predecessor.Right = curr.Rightcurr.Left, curr.Right = nil, next}curr = curr.Right}
}