Skip to content

Commit 36d75aa

Browse files
committed
Added documentation for JS problem 115
1 parent b89b090 commit 36d75aa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

javascript/115-Distinct-Subsequences.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//////////////////////////////////////////////////////////////////////////////
2+
// 1D Dynamic Programming
3+
// Time: O(n*m)
4+
// Space: O(m)
5+
//////////////////////////////////////////////////////////////////////////////
6+
17
/**
28
* @param {string} s
39
* @param {string} t
@@ -28,6 +34,12 @@ function numDistinct(s, t) {
2834
return cache[0];
2935
}
3036

37+
//////////////////////////////////////////////////////////////////////////////
38+
// 2D Dynamic Programming
39+
// Time: O(n*m)
40+
// Space: O(n*m)
41+
//////////////////////////////////////////////////////////////////////////////
42+
3143
/**
3244
* @param {string} s
3345
* @param {string} t
@@ -63,6 +75,12 @@ function numDistinct(s, t) {
6375
return cache[0][0];
6476
}
6577

78+
//////////////////////////////////////////////////////////////////////////////
79+
// Depth First Search Recursion With Memoization
80+
// Time: O(n*m)
81+
// Space: O(n*m)
82+
//////////////////////////////////////////////////////////////////////////////
83+
6684
/**
6785
* @param {string} s
6886
* @param {string} t

0 commit comments

Comments
 (0)