def test_2(self): self.assertEqual( 5, self.lowestCommonAncestor( hlp.array_to_tree([3, 5, 1, 6, 2, 0, 8, None, None, 7, 4]), nd.node(5), nd.node(4)))
def test_3(self): self.assertEqual([3, None, 2, None, 1], hlp.tree_to_array( self.upsideDownBinaryTree( hlp.array_to_tree([1, 2, None, 3]))))
def test_1(self): self.assertEqual([4, 5, 2, None, None, 3, 1], hlp.tree_to_array( self.upsideDownBinaryTree( hlp.array_to_tree([1, 2, 3, 4, 5]))))
def test_2(self): self.assertEqual([2, 1], hlp.tree_to_array( self.upsideDownBinaryTree( hlp.array_to_tree([1, 2]))))
def test_2(self): self.assertEqual( 2, self.lowestCommonAncestor( hlp.array_to_tree([6, 2, 8, 0, 4, 7, 9, None, None, 3, 5]), nd.node(2), nd.node(4)))