Skip to content

Commit d4cc857

Browse files
committed
fix: modify space complexity
1 parent 98eaeb2 commit d4cc857

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

best-time-to-buy-and-sell-stock/taewanseoul.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
// O(n) time
11-
// O(n) space
11+
// O(1) space
1212
function maxProfit(prices: number[]): number {
1313
let highestProfit = 0;
1414
let left = 0;

0 commit comments

Comments
 (0)