Skip to content

Commit

Permalink
Update different-ways-to-add-parentheses.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Jul 27, 2015
1 parent ab3df48 commit 7f4346a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Python/different-ways-to-add-parentheses.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Time: O(n * 4^n / n^(3/2)) ~= n * Catalan numbers = n * (C(2n, n) - C(2n, n - 1)),
# due to the size of the results is Catalan numbers,
# and every way of evaluation is the length of the string,
# so time complexity is n * Catalan numbers.
# Space: O(n * 4^n / n^(3/2))
# so the time complexity is at most n * Catalan numbers.
# Space: O(n * 4^n / n^(3/2)), the cache size is at most n * Catalan numbers.
#
# Given a string of numbers and operators, return all possible
# results from computing all the different possible ways to
Expand Down

0 comments on commit 7f4346a

Please sign in to comment.