Skip to content

Commit

Permalink
Merge pull request #160 from NYCGithub/patch-5
Browse files Browse the repository at this point in the history
Update increasing-subsequences.py
  • Loading branch information
kamyu104 authored Sep 12, 2018
2 parents e9deacf + eabbc2c commit 6e47d0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Python/increasing-subsequences.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Time: O(n * 2^n)
# Space: O(n^2)
# Space: O(n), longest possible path in tree, which is if all numbers are increasing.

# Given an integer array, your task is
# to find all the different possible increasing
Expand Down Expand Up @@ -27,7 +27,7 @@ def findSubsequencesHelper(nums, pos, seq, result):
lookup = set()
for i in xrange(pos, len(nums)):
if (not seq or nums[i] >= seq[-1]) and \
nums[i] not in lookup:
nums[i] not in lookup:
lookup.add(nums[i])
seq.append(nums[i])
findSubsequencesHelper(nums, i+1, seq, result)
Expand Down

0 comments on commit 6e47d0a

Please sign in to comment.