Skip to content

Commit

Permalink
Update path-sum.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Feb 10, 2015
1 parent f0363d9 commit 07327bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Python/path-sum.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Time: O(n)
# Space: O(logn)
# Space: O(h), h is height of binary tree
#
# Given a binary tree and a sum, determine if the tree has a root-to-leaf path
# such that adding up all the values along the path equals the given sum.
Expand Down Expand Up @@ -42,4 +42,4 @@ def hasPathSum(self, root, sum):
root.right = TreeNode(8)
root.left.left = TreeNode(11)
root.left.left.right = TreeNode(2)
print Solution().hasPathSum(root, 22)
print Solution().hasPathSum(root, 22)

0 comments on commit 07327bd

Please sign in to comment.