# -*- coding:utf-8 -*-
# class TreeLinkNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# self.next = None
class Solution:
def GetNext(self, pNode):
if pNode.right:
p = pNode.right
while p.left:
p = p.left
return p
if pNode.next and pNode.next.left == pNode:
return pNode.next
father = pNode.next
while father and father.left != pNode:
pNode = father
father = father.next
return father
网友评论