注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
#/////////////////////////////////////////////////////////////////////////////////////// # # Given a list of pairs, where each pair (i, j) # e.g. (3, 8) (8, 4) (4, 2) (5, 8). # 3 -> 2 # #/////////////////////////////////////////////////////////////////////////////////////// def isPath(pairs, start, end): if key1 < root.key <key2 or key1 > root.key > key2: return root if key1 < root.key >key2: root = root.left else: root = root.right return root
|