Skip to content

Commit

Permalink
Update increasing-subsequences.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Sep 12, 2018
1 parent e1fa441 commit eabbc2c
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) #Longest possible path in tree, which is if all numbers are increasing.
# 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 eabbc2c

Please sign in to comment.