From e1fa4419e58ffacff9418e74e933d3a63341c1b3 Mon Sep 17 00:00:00 2001 From: NYCGithub <35183837+NYCGithub@users.noreply.github.com> Date: Tue, 11 Sep 2018 23:09:41 -0400 Subject: [PATCH 1/2] Update increasing-subsequences.py Return result does not count in space complexity. --- Python/increasing-subsequences.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/increasing-subsequences.py b/Python/increasing-subsequences.py index 6639959bc..08f2b53dc 100644 --- a/Python/increasing-subsequences.py +++ b/Python/increasing-subsequences.py @@ -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 From eabbc2c1c80f18238de656c9ec81a78e93f20a98 Mon Sep 17 00:00:00 2001 From: kamyu Date: Thu, 13 Sep 2018 00:03:55 +0800 Subject: [PATCH 2/2] Update increasing-subsequences.py --- Python/increasing-subsequences.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/increasing-subsequences.py b/Python/increasing-subsequences.py index 08f2b53dc..c546bf9d1 100644 --- a/Python/increasing-subsequences.py +++ b/Python/increasing-subsequences.py @@ -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 @@ -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)