Skip to content

Commit 569cc1c

Browse files
authored
Update UniqueSubsequencesCount.java
1 parent 7858443 commit 569cc1c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/com/thealgorithms/dynamicprogramming/UniqueSubsequencesCount.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ private UniqueSubsequencesCount() {
1414
throw new UnsupportedOperationException("Utility class");
1515
}
1616

17-
private static Set<Character> set = new HashSet<>();
18-
1917
public static int subseqCount(String str) {
2018

2119
int[] dp = new int[str.length() + 1];
@@ -34,7 +32,7 @@ public static int recursiveCall(String st, int idx, int[] dp) {
3432
return dp[idx];
3533
}
3634

37-
set = new HashSet<>();
35+
Set<Character> set = new HashSet<>();
3836

3937
int res = 0;
4038

@@ -49,6 +47,7 @@ public static int recursiveCall(String st, int idx, int[] dp) {
4947
res = 1 + recursiveCall(st, j + 1, dp) + res;
5048
}
5149

52-
return dp[idx] = res;
50+
dp[idx] = res;
51+
return dp[idx];
5352
}
5453
}

0 commit comments

Comments
 (0)